Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS line-height property

CSS line-height property

Example

Set the line height using a percentage:

p

.small

{

line-height:

90

%

}

p

.big

{

line-height:

200

%

}

Try it »

There are more examples at the bottom of this page.


Property definition and usage

Set the line height as a percentage:.

Note: Negative values are not allowed

Default value: normal
Inherited: yes
Version: CSS1
JavaScript syntax: object.style.lineHeight="2"

Browser support

The numbers in the table indicate the first browser version that supports this property.

property
line-height 1.0 4.0 1.0 1.0 7.0

Attribute values

Value Description
normal Default. Sets a reasonable line spacing.
number Sets a number that is multiplied by the current font size to determine the line spacing.
length Set a fixed line spacing.
% Line spacing as a percentage of the current font size.
inherit Specifies that the value of the line-height property should be inherited from the parent element.

More examples

Set the line spacing using pixel values
This example demonstrates how to set the line spacing in a paragraph using pixel values.

Set the line spacing using a number
This example demonstrates how to set the line spacing in a paragraph using a number.


Related Articles

CSS Tutorial: CSS Text