8

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%.

TylerH
  • 20,799
  • 66
  • 75
  • 101
daveywc
  • 3,136
  • 7
  • 45
  • 58

1 Answers1

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