em conversion in css
August 9, 2007 at 2:53 am Leave a comment
Before converting em’s read the below paragraph carefully.
Originally from the typographic world, an em is a unit that represents the height of the capital letter M for a particular font. In Web pages, one em is the height of the Web browser’s base text size, which is usually 16 pixels. However, anyone can change that base size setting, so 1em may be 16 pixels for one person, but 24 pixels in someone else’s browser. In other words, ems are a relative unit of measurement.
In addition to the browser’s initial font size setting, ems can inherit size information from containing tags. A type size of .9em would make text about 14 pixels tall on most browsers with a 16 pixel base size. But if you have a <p> tag with a font size of .9ems, and then a <strong> tag with a font size of .9ems inside that <p> tag, that <strong> tag’s em size isn’t 14 pixels it’s 12 pixels (16 x .9 x .9). So keep inheritance in mind when you use em values.
Entry filed under: css.
Trackback this post | Subscribe to the comments via RSS Feed