Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

max-width using em

Tags:

css

em

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

like image 214
daveywc Avatar asked Feb 29 '12 21:02

daveywc


2 Answers

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.

like image 172
Sebastian vom Meer Avatar answered Sep 30 '22 18:09

Sebastian vom Meer


This site, http://pxtoem.com, makes conversion and has a table of each size.

like image 36
Tarik Avatar answered Sep 30 '22 18:09

Tarik