views:

44

answers:

3

I have a wrapper of certain width. I want to float 3 boxes inside that wrapper. What unit should I specify the size of the boxes in — px, em or %?

+1  A: 

If the wrapper has a certain (fixed?) width, then percentages would be the right way (assuming that the height of the 3 boxes may vary). Otherwise, when using em values, the 3 boxes won't fit into the wrapper side by side if the user enlarges font sizes via the browser.

Paul
If of course the wrapper has _always_ the same width, you may also use pixel widths for the 3 boxes.
Paul
+1  A: 

This should help :)

See Also:

Difference between em, % and px

Sarfraz
A: 

Using percentages will probably give you rounding issues, so use whatever unit you used the set the "certain width" of the container (and if you used percentages for that, you'll have to live with the rounding issues).

David Dorward