CSS line-height property

Examples

Set the line height in percent:

p.small {line-height: 90%}
p.big {line-height: 200%}



In the bottom of this page for more examples.

Attribute definitions and instructions

Setting line height in percent:

Note: negative values are not allowed

Defaults: normal
inherit: yes
version: CSS1
JavaScript syntax: object .style.lineHeight = "2"


Browser Support

Figures in the table represent the first browser to support the version number of the property.

属性
line-height 1.0 4.0 1.0 1.0 7.0

Property Value

value description
normal default. Set a reasonable line spacing.
number Set the number, this number will be multiplied with the current font size to set the line spacing.
length Set a fixed line spacing.
% Spacing based on the current font size of the percentage of rows.
inherit Provisions should inherit the property line-height value from the parent element.


Examples

More examples

Using the pixel value is set line spacing
This example demonstrates how to use the pixel values ​​to set the paragraph line spacing.

Use to set the line spacing value
This example demonstrates how to use a value to set the paragraph line spacing.


related articles

CSS tutorial: CSS the Text