Take the 2-minute tour ×
User Experience Stack Exchange is a question and answer site for user experience researchers and experts. It's 100% free, no registration required.

I cannot delete the question but I have moved it to SO:
http://stackoverflow.com/questions/3600204/mixing-percent-and-fixed-css

Should you ever apply percentage and fixed CSS together? Will it cause problems, and if so what kinds?

  • I have heard that mixing can degrade render performance?
  • I have hard mixing can give you weird results on initial load with progressive rendering browsers?

EDIT: Below is just an example of mixed usage. I am not looking for validation of the example. I have heard you should never do what I have in the example below, so I am trying to find out if using CSS in this manner is an issue.

Example:

<style>
.container
{
    width:300px;
}
.cell
{
    width:25%;
}
</style>

<table class="container">
     <tr>
        <td class="cell"><td>
        <td class="cell"><td>
        <td class="cell"><td>
        <td class="cell"><td>
     </tr>
</table>
share|improve this question
2  
I think this question would be better asked on StackOverflow, where you're more likely to get a very accurate answer. –  Rahul Aug 28 '10 at 19:34
1  
I don't need the example solved, it is just for illustration, I want to know if mixed usage is an acceptable practice. –  rick schott Aug 28 '10 at 21:28
    
Only a Sith deals in absolutes. –  Fraser Aug 28 '10 at 22:49
3  
@rick: It's still a technical question, rather than about usability. –  Gelatin Aug 29 '10 at 1:45
    
Is this a usability forum or UI? Will gladly remove if its doesn't fit here. –  rick schott Aug 29 '10 at 2:37
show 2 more comments

closed as off topic by Rahul, ign, Patrick McElhaney Aug 30 '10 at 13:10

Questions on User Experience Stack Exchange are expected to relate to user experience within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

5 Answers

there is no problem with your CSS. there is a container in pixel then inside it, there are cells with percent. So 300px will be divided by four to make 25% width cells. but if you add more cells there will be unexpected problems depend on the browser you use.

share|improve this answer
add comment

If you had two different cell classes where one used percent and the other pixels then you would be in trouble. However you are only using percent inside the table and it adds up to 100%, so there should be no problems.

Though there could be a problem if the cells overflows, but I'm no expert in table/overflow behavior.

People make tables like this all the time, so you are not doing anything wrong. Depending on what you want to accomplish you may consider using: <div>, <span>, <li>

share|improve this answer
add comment

I don't understand the issue. The point of % is for relative sizes but if you know the size of the container and you know you want something to be n % of that container just pull out you calculator (container width / n) and put the size in the css.

share|improve this answer
    
See update, you missed the point of my question, I have added some clarity. –  rick schott Aug 29 '10 at 1:28
2  
It doesn't matter what the example is. If you know the size of the container and the % of the elements inside, then you can simply calculate. –  Sruly Aug 29 '10 at 7:03
add comment

% inside a fixed width will always be ok, the other way around could generate problems. If your fixed width is wider than the % space available you might experience some weird overflow issues.

share|improve this answer
add comment

From the tags you chose, I'm guessing you're concerned with the layout of elements on your (web) page. Using percentages of a fixed amount may cause problems if the fixed width is provided by something external (such as the browser window's current dimensions). Your table cells may end up too narrow for the content.

This answer may be obvious to you, but then, as you can tell from other responses, your question isn't as clear as some of us would have liked, so I'm taking a bit of a guess at your intent. :o

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.