Can someone please explain how the em unit of measurement works with the max-width css property? On my screen resolution of 1920 x 1080 I have found that setting the max-width to 140em is the equivalent of max-width of 100%.
Asked
Active
Viewed 1.4k times
8
-
1Are you sure that it's *actually* the width of your monitor, or is it just clipping because you're setting the maximum width, and not the actual width? – cwharris Feb 29 '12 at 21:54
-
You probably need to understand the em unit itself first. – BoltClock Feb 29 '12 at 21:55
-
the amazing em unit - http://www.w3.org/WAI/GL/css2em.htm – Matt K Feb 29 '12 at 21:57
1 Answers
12
Em is just another unit. It depends on the font size. Current font size (e.g. 14px) = 1em. 2em doubles the font size (28px).
Have a look at your screen resolution: 1920/140 = 13,714285714 - looks like your current font size is 14px. Therefore setting max-width:140em
is the same like max-width:1920px
or max-width:100%
- in your special case.

Sebastian vom Meer
- 5,005
- 2
- 28
- 36