An em
comes from the typographical term of the same name. It is the width of the letter 'm' in the current font. If you set a width to, say, 10em
, then the width will be fixed at 10 times the width of an 'm'.
%
is a number of hundredths of a whole. It describes a size that is dependent on its potential maximum. So, assuming a simple web page viewed in a browser window, with no columns or anything, a width of 50%
means half (50/100) of the width of the window. The actual width will change with the width of the window. If you printed the page out, then the width changes to half the width of the printable area on the paper.
Which one you use depends on whether or not you need the dimension in question to adjust with window size. If you need it to adjust, use %
. If you need it to remain a fixed dimension, use em
.
EDIT: Ah, relating to the font-size
descriptor. Referring to some online docs I use, font-size
with a %
makes the font size relative to its parent. What's the parent of body
? A good question that my reference doesn't answer. I would assume it's either a higher-level specifier (i.e. one that would be overridden) in the CSS, or the document default.
As for em
, that one takes the length in ems (as defined above) and converts that to a font size (by, say, converting to mm then to points). Since most fonts don't have an em equal to the line height, I wouldn't expect 1em
to mean the same as 100%
.