Archive for February, 2007
EM Calculator
Here is a very nice tool to help convert pixels into em units. It also shows how the em unit of a parent element effects the child elements.
I’ve been using em units instead of pixels for a while now and think the somewhat quirky behavior is worth dealing with. Here is a little hack I use:
/* CSS */
div#container { font-size:62.5%; }
p { font-size:1.2em; }
<!-- HTML -->
<div id="container">
<p>Lorem ipsum dolor!</p>
</div>
The 62.5% in div#container basically resets 1.0em to 10px. So… if you want all paragraphs to be around 12px in size, you set them to 1.2em.




