achtungbaby.net

Icon

Postcards from the Front-End

Finally, a pixel-to-em conversion that works

Long have I yearned for a simple, straightforward way to convert pixels to em’s, regardless of inheritance issues.

Apparently those wise front-end engineers at Yahoo have already figured it out:

Width divided by 13 = em’s for standards-compliant browsers;

Em’s for standards-compliant browsers multiplied by 0.9759 for IE, including IE7

So a 974px width container for is 74.923em’s for Firefox et al and 73.117em’s for IE.

Of course, this assumes you are setting a base font on your body tag of 13px, the golden number Yahoo uses in computing their grid structure.

Category: Technology

Tagged: , , ,

Comments are closed.

@achtungbaby