CSS propertyTypography

line-height

Sets the height of each line of text, the space between lines.

Initial value
normal
Inherited
Yes
Animatable
yes, as a number or length
Applies to
all elements
JavaScript
element.style.lineHeight = "1.6"
On this page

Example

#
CSS
body {
  line-height: 1.6;
}

h1 {
  line-height: 1.15;
}
Preview

Definition and usage

#

The line-height property sets the height of every line of text. The extra space splits evenly above and below the characters, so a larger value gives more room between lines.

It’s best to give it as a unitless number, for example 1.6. That value gets multiplied by each element’s own font size. Values with a unit (24px, 1.5em) are calculated once and inherited as a fixed number of pixels, which throws off the spacing in elements with a different font size.

For running text, 1.5-1.7 works well, and for large headings, smaller values, for example 1.1-1.2.

Syntax

#
Syntax
line-height: normal | <number> | <length> | <percentage>;

Values

#
  • normal

    The default value, usually around 1.2 depending on the font.
  • 1

    Lines packed tightly, one right under the next.
  • 1.6

    A comfortable line height for running text.
  • 2.2

    Very loose spacing.

Values in practice

#

normal

The default value, usually around 1.2 depending on the font.
.demo { line-height: normal; }

1

Lines packed tightly, one right under the next.
.demo { line-height: 1; }

1.6

A comfortable line height for running text.
.demo { line-height: 1.6; }

2.2

Very loose spacing.
.demo { line-height: 2.2; }

Browser support

#

Widely available

Works in all modern browsers, phones included. You can use it without worry.

  • Chrome
  • Edge
  • Firefox
  • Safari

Good practices

#
  • Give line-height as a unitless number. You’ll avoid cramped lines in elements with a larger font.
  • Centering a single line of text in a button with a line-height equal to its height works, but Flexbox or Grid are safer.

Related entries

#

Spotted a mistake or missing an example? Write to us.