Click to See Complete Forum and Search --> : How much is 2em in 1024x768px display?


toplisek
08-17-2009, 03:57 AM
I would like to know how much is em in terms of px in case of common parent like code:

div {
padding: 0 0 0 1em
}

Can I calculate px padding from this if I have within body the following:

body {
line-height : 140%;
margin-top : 20px;
}

KDLA
08-17-2009, 10:15 AM
It depends on the browser. Fx tends to equate 1em to 14px; IE's is a little larger at 16px.

What I do, is put a base of 10px in the body, so that all em sizes are easily calculated:

body {font-size: 10px;}
p {font-size: 1.2em;} /*equals 12px*/
div {font-size: 1.5em} /*equals 15px*/