Re: font sizes in ems

Douglas Rand:
> Why is this true?  An em-space isn't necessarily the same as the font
> height.  The font height should be the basis for the relative
> (percentage) size,  not the em-space width.

An em is the term used to designate the square of any type size.
Therefore an em will always be equal to 100% of any given type size in
both the vertical and horizontal dimensions. Em is normally used in
horizontal measurements such as margins and indents. In fact, until ems
became a 'standard' CSS1 measure, I don't think I ever saw ems used to
specify vertical measure. However, specifying type for an unknown size
translation is relatively new. 

> I'm guessing that you (unfortunately) picked a font where an em-space
> about the same as the font height..

I'm guessing you never spec'd type the old-fashioned way, with
handwritten markup that had to be understood by a typesetter. An em for
12pt type is 12pt, regardless of font-family. 

> Why do people think it's a good idea to specify font sizes in terms
> ems?

The use of percent is equivalent when you are referring to font-size.
100% = 1em. 50% = 1en. (Very simple. Why are people trying to
complicate the issue?)

However, when you are referring to other elements, percent DOES NOT
refer to font size. For example, setting the height of an inline IMG to
a percentage is N/A. Using em measurement, an author/designer can
insure that the image is sized to the height of the adjacent text, even
when they don't know the font-size of the text. Another situation where
em is valuable is for indents and margins. Percent does not mean the
same thing as em. A designer will typically specify indents in ems,
because the most important relationship is to font-size, not to the
horizontal dimension of the canvas.

A simple change to the CSS1 spec would clarify em measure:

current:   "ems, the height of the element's font"

change:    "An em is equal to the element's font-size"

BTW, this section, strictly speaking, is incorrect:

"The relative units 'em' and 'ex' are relative to the font size of the
element itself. The only exception to this rule in CSS1 is the
'font-size' property where 'em' and 'ex' values refer to the font size
of the parent element."

'ex' is specific to both font-size and font-family. 'em' is specific
only to a particular font-size.

David Perrell

Received on Friday, 18 July 1997 16:07:54 UTC