I have a wrapper of certain width. I want开发者_StackOverflow中文版 to float 3 boxes inside that wrapper. What unit should I specify the size of the boxes in — px
, em
or %
?
This should help :)
See Also:
Difference between em, % and px
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.
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).
精彩评论