You are here: Re: Pixel to Em conversion... « HTML « IT news, forums, messages
Re: Pixel to Em conversion...

Posted by Jukka K. Korpela on 05/30/07 09:31

Scripsit Ben C:

>> An em is the font height (or the font height of the parent element
>> when you are specifying the font-size).
>
> Technically it's a measure of width (of an 'M') rather than of height.

No it isn't. This disinformation used to be regularly presented and refuted
in various newsgroups, but recently it has been more quiet. Anyway, if in
doubt,
a) check the CSS specifications
b) make a simple test:
<div style="width:1em; height:1em; line-height:1; background:yellow:
color:black;font-size:300%">M</div>
and see if the width of M equals the width of the em square. To save your
time: it doesn't, except perhaps in some very fancy font - for most fonts,
it's considerably narrower.

> An ex is supposed to be a measure of height (of an 'x'), but most
> browsers don't bother to get exes exactly right.

Most browsers implement ex as 0.5em, which is exactly wrong for almost any
font - though perhaps a rough _average_ over fonts. Firefox 2 gets ex right.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация