Jump to content

Year

Day

24 Ways to impress your friends

2 12/2005 An Explanation of Ems

by Richard Rutter

Ems are so-called because they are thought to approximate the size of an uppercase letter M (and so are pronounced emm), although 1em is actually significantly larger than this. The typographer Robert Bringhurst describes the em thus:

The em is a sliding measure. One em is a distance equal to the type size. In 6 point type, an em is 6 points; in 12 point type an em is 12 points and in 60 point type an em is 60 points. Thus a one em space is proportionately the same in any size.

To illustrate this principle in terms of CSS, consider these styles:

#box1 {
     font-size: 12px;
     width: 1em;
     height: 1em;
     border:1px solid black;
}
#box2 {
     font-size: 60px;
     width: 1em;
     height: 1em;
     border: 1px solid black;
}

These styles will render like:

M

and

M

Note that both boxes have a height and width of 1em but because they have different font sizes, one box is bigger than the other. Box 1 has a font-size of 12px so its width and height is also 12px; similarly the text of box 2 is set to 60px and so its width and height are also 60px.

About the author

Richard Rutter is Production Director at Clearleft web design consultants. He massages his ego on Clagnut where he harps on about accessibility, web standards and mountain biking. Richard has just launched A Practical Guide to Web Typography where he combines his passions for CSS and typography.

Comments

Commenting is closed for this article.

by Richard Rutter

About the author

Richard Rutter

Richard Rutter is a user experience consultant and director of Clearleft. He runs an ongoing project called The Elements of Typographic Style Applied to the Web, where he extols the virtues of good web typography. Richard occasionally blogs at Clagnut, where he writes about design, accessibility and web standards issues, as well as his passion for music and mountain biking.

More information

In association with:

Perch - a really little cms