What is the value of an em in terms of pixels?
10em = ?px ?
There's no specific relationship between em and px. It's computed based on the width of the "m" character for each font-face.
While as others have said, there is no set ratio - as it varies from font to font - it is possible to calculate this for a particular font face/size combination by using DHTML.
Simply create a div with
style="width: 1em; visibility:hidden"
and append it to the place in the document you are interested about.
You can then find out its width by checking the div's clientWidth
property
It depends on the font and the platform you're rendering on. There is no universal ratio.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With