HTML and CSS Reference
In-Depth Information
All the popular browsers support this property.
8.4.6.2. The line-height property
Use the line-height property to define the minimum spacing between
lines of a tag's text content. Normally, browsers single-space text lin-
esthe top of the next line is just a few points below the last line. By
adding to that line height, you increase the amount of space between
lines.
The line-height value can be an absolute or a relative length, a percent-
age, a scaling factor, or the keyword normal . For example:
p {line-height: 14pt}
p {line-height: 120%}
p {line-height: 2.0}
The first example sets the line height to exactly 14 points between
baselines of adjacent lines of text. The second computes the line height
to 120 percent of the font size. The last example uses a scaling factor
to set the line height to twice as large as the font size, creating double-
spaced text. The value normal , the default, is usually equal to a scaling
factor of 1.0 to 1.2.
Keep in mind that absolute and percentage values for line-height com-
pute the line height based on the value of the font-size property. Chil-
dren of the element inherit the computed property value. Subsequent
changes to font-size by either the parent or the child elements do not
change the computed line height.
Scaling factors, on the other hand, defer the line-height computation
until the browser actually displays the text. Hence, varying font sizes
affect line height locally. In general, it is best to use a scaling factor for
the line-height property so that the line height changes automatically
as the font size changes.
 
Search WWH ::




Custom Search