Prev | Current Page 68 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"


2 http://www.w3.org/TR/CSS21/syndata.html#length-units
3 It could even be argued that the unit should be omitted if the number is 0.
4 The line-height property can take a non-zero, unit-less value, but it??™s not a value of the type
.
General Syntax and
Nomenclature
The Ultimate CSS Reference 30
Relative Units Explained
The three possible relative units are listed in Table 2.1.
Table 2.1: Relative Units
Description Unit
the current font size em
the x-height of the current font ex
pixels px
The em and ex units depend on the font size that??™s applied to the element.
A measurement of 1em is defined as being equal to the font size, however that may
be defined. When we specify a font size in em, 1em is equal to the inherited font
size??”that is, the size the text would have had if we hadn??™t changed it. As such,
font-size:1.2em; makes the text 1.2 times larger than the parent element??™s text.
This unit??™s name is a centuries-old legacy from the typographic world, where an
M-square or ???mutton square??? was a blank, square type whose sides??™ length was
equal to the width of an uppercase M??”usually the widest character??”in that font.


Pages:
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80