HTML and CSS Reference
In-Depth Information
■
The draft CSS3 Fonts module envisages a major expansion of the role of the
font-variant
property,
controlling ligatures, swashes, stylistic variants, historical forms, and East Asian alternatives. These features are not
yet implemented by any browser.
Note
Adjusting the Vertical Space Between Lines of Text
he
line-height
property controls the vertical space—or leading—between lines of text. Setting the
line-height
property affects the readability of a web page. Too little space and the text looks cramped and is hard to read. Too
much space and the reader's eye wanders, making reading equally difficult.
This property accepts a length, percentage, or number. You can also use the keyword
normal
to reset
line-height
to its default value. Negative values are not permitted.
Because of the way
line-height
is calculated and applied by browsers, the most consistent results are
achieved by using a number
without
a unit of measurement like this:
line-height: 1.4;
The default value applied by browsers varies but is normally in the range of 1.0-1.2. You can use positive
values less than 1, but anything smaller than about 0.6 results in lines overlapping each other.
Figure
4-6
shows
line-height.html
with the same paragraph of text displayed with different amounts of
vertical space between the lines. The first paragraph uses the browser's default setting. The other three have
line-height
set to
0.8
,
1.4
, and
1.8,
respectively.
Figure 4-6.
The amount of vertical space between lines of text affects readability
Using the Shorthand font Property
CSS shorthand properties let you combine several style declarations into one. Unfortunately, the
font
shorthand
property can be difficult to remember, and if you get it wrong, your styles aren't applied.
he
font
shorthand property combines the following properties:
font-style
(optional)
font-variant
(optional)