"px" to "em"
- Started
- Last post
- 8 Responses
- Drno
i have this fixed width of 980px,
can someone explain to me how to convert it in"em", apparently ems only apply to text, but i've seen layout using them
thanx a lot
- jox0
px * 0.0626 = em
For instance,
15px * 0.0626 = 0.939em
80px * 0.0626 = 5.008em
- Drno0
thanx you jox,
if i wasn't a lesbian i'll kiss you
- Witt0
mamma mia
- brtman0
if font-size is 100% (default in most browsers), 1em corresponds to 16px.
you can apply a height or width in ems at img's too so they scale along with the other em-parts.
- brtman0
one other thing: browsers calculate the em's in slightly different way, so sometimes you can see 1px differences between browsers .
good luck
- myobie0
if you want to start with 1 em being 10px in most browsers, set body font-size to 62.5%
makes the math a bit easier
of course this assumes the default font size is 16 (which it is on most)
- Point50
dear god, when jox replied I though "wow, that's simple enough, maybe I'll understand this em thing one day"... then the rest of you fuckers just had to throw mad variables in this bitch
*head explodes