O'Reilly logo

Cascading Style Sheets: The Definitive Guide by Eric A. Meyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

line-height — IE4 P/P | IE5 P/Y | NN4 P/P | Op3 Q/-

Synopsis

This influences the layout of line boxes. The difference between the value of line-height and the value of font-size is called leading, and half of the leading (otherwise known as half-leading) is applied above and below the content of an element or line of text. Negative values are not permitted. Using a number defines a scaling factor that is multiplied by the font-size, and the number itself is inherited, not the computed value. This allows for much more intelligent page layout, and is strongly preferred over other methods of setting line-height.

The drawback to using a number value is that IE3 will interpret it as a number of pixels. See Chapter 8 for a detailed discussion of line-height and line boxes.

Example

P {line-height: 18pt;}
H2 {line-height: 200%;}

Values

normal | <number> | <length> | <percentage>

Default

normal

Inherited

yes

Applies to

all elements

Percentage values relative to the font size of the element itself

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required