3) warrant a little more explanation.
Em and ex are both measurements of type size. The em is derived
from the width of the characters in a font, so its size varies, depending
on which font you are using. Ex is the equivalent of the x-height
of the given font (so named because it is the height of a lowercase
x??”in other words, the center bit without the ascenders and
descenders that appear on characters such as p and d).
TABLE 2.3 Relative Values
RELATIVE VALUE UNIT ABBREVIATION EXAMPLE
Em em height:1.2em
Ex ex height:6ex
Percentage % height:120%
Percentages are useful for setting the width of containing elements,
such as divs, to the proportion of the browser width, which is the
one way to create ???liquid??? designs that smoothly change size as the
STYLIN??™ WITH CSS - CHAPTER 2 62
user resizes the browser window. Using percentages is also the right
way to get proportional leading (pronounced like lead, the metal),
which is the distance between the baseline of one line of text and
the next in a multiple-line text block such as a paragraph. You will
learn more about leading in Chapter 3.
Why You Should Use Ems to Specify Type Sizes
There are two important bene?¬? ts to using a relative sizing method like ems
to specify your font sizes:
??? You can use inheritance to your advantage by declaring the body element
to have a size of 1em, and this becomes a sizing baseline because
it causes all other element??™s text to size relative to it.
Pages:
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100