Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

CSS line-height property


May 05, 2021 CSS Reference Manual


Table of contents


CSS line-height property


Set the line height in percent:

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

Try it out . . .

There are more examples at the bottom of this page.

Description of property definition and use

Set the line height as a percentage: .

Note: Negative values are not allowed

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


Browser support

The numbers in the table support the first browser version number of the property.

Attributes
line-height 1.0 4.0 1.0 1.0 7.0

The property value

Value Describe
normal Default. Set reasonable line spacing.
number Set the number, which is multiplied by the current font size to set the line spacing.
length Set a fixed line spacing.
% Line spacing based on the percentage of the current font size.
inherit Specifies that the value of the line-height property should be inherited from the parent element.


CSS line-height property

More instances

Use pixel values to set line spacing
This example shows how to use pixel values to set line spacing in a paragraph.

Use numeric values to set line spacing
This example shows how to use a number to set the line spacing in a paragraph.


Related articles

CSS tutorial: CSS Text