XML technologies / CSS / Advanced websites with CSS / CSS property reference / line-height
(Excerpt from “CSS − Advanced websites with Cascading Stylesheets” by Rachel Andrew & Dan Shafer)
The property line-height describes an element’s line height. If a line contains more than one element, the element with the largest setting for line-height determines the height of the entire line.
Inherited: Yes (with differences between the formats listed below)
Values
line-height supports the following formats:
normal: This constant is the default value and, according to the CSS specification, corresponds to a numeric value between1.0and1.2.numerischer Wert: A numeric value (for example1.5), multiplied by the font size, gives the line height. A setting of1.0packs lines as tightly as possible without characters overlapping. A setting of1.2produces normal line spacing. The value is inherited as a proportional factor and as an absolute value already computed for the parent element. For a child element with larger text, an inherited value produces correspondingly greater line spacing than for the parent element with smaller text.CSS-Maßangabe: An absolute CSS length (for example50px) or a relative CSS length. A relative value inem(em height) produces the same result as a numeric value, but passes the value already computed for the parent element to child elements rather than a proportional factor.Prozentwert: A percentage multiplied by the font size gives the line height. As with lengths, the line height is proportional to the font size, but child elements inherit the value already computed for the parent element rather than a proportional factor.
Default value: normal
Compatibility
CSS version: 1
Works in all CSS-capable browsers, including Internet Explorer version 4 and later, Netscape version 4 and later, and Mozilla.
Example
The following style rule gives elements of class luftig a line height equal to one and a half times the font size:
.luftig {
line-height: 1.5;
}Because a numeric value is declared, child elements’ line height is calculated as a proportional factor of 1.5 times their own font size. If a value of 150% or 1.5em were used instead, child elements would receive the parent element’s absolute line height.
Copyright © 2006 of the German translation, dpunkt.verlag GmbH
You may print the online version for your private use.
Otherwise, this chapter from “CSS − Anspruchsvolle Websites mit Cascading Stylesheets” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
dpunkt.verlag GmbH, Ringstraße 19, 69115 Heidelberg