HTML and CSS Reference
In-Depth Information
Another typographic feature that you can set is leading , which is the space between
lines of text. The style to set the leading value is
line-height: size ;
where size is a specifi c length or a percentage of the font size of the text on the affected
lines. If no unit is specifi ed, most browsers interpret the number to represent the ratio
of the line height to the font size. The standard ratio is 1.2:1, which means that the line
height is usually 1.2 times the font size. By contrast, the style rule
p {line-height: 2em;}
makes all paragraphs double-spaced. A common technique for multi-line titles is to give
title text more impact using large fonts and small line heights. Use the demo page to see
how this works.
To use the demo to explore leading styles:
1. If necessary, return to the demo_css.htm page in your Web browser.
2. Enter 0.75 in the line-height box, and then select em from the corresponding
unit box.
3. Press the Tab key to apply the line-height style. Figure 3-31 shows the revised
appearance of the text.
Figure 3-31
Setting the line height
line-height s e t to 0.75em
An additional way to control text spacing is to set the indentation for the fi rst line of a
block of text. The style is
text-indent: size ;
where size is a length expressed in absolute or relative units, or as a percentage of the
width of the text block. For example, an indentation value of 5% indents the fi rst line by
5% of the width of the block. The indentation value also can be negative, extending the
fi rst line to the left of the text block to create a hanging indent .
Search WWH ::




Custom Search