CSS line-height Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The line-height property sets the height of a line box. In everyday horizontal text, that mainly controls how far lines sit apart (leading).

The initial value is normal (often about 1.2, font-dependent). Prefer a unitless number such as 1.5 so children scale with their own font-size. It is inherited. You can also set it inside the font shorthand.

Baseline widely available.

Not deprecated. For main paragraphs, aim for about 1.5 or higher for accessibility. Prefer unitless values over em / % when the value will be inherited.

CSS Syntax

syntax.css
line-height: normal | <number> | <length> | <percentage> | initial | inherit;

Study starters: normal, 1.5, 1.5em, 150%.

Property Values

ValueDescriptionTry it
normalBrowser / font default (often ~1.2). Initial valueTry it
<number>Unitless multiplier of the element’s font size. PreferredTry it
<length>Fixed height such as 24px or 1.5emTry it
<percentage>Percent of the element’s own font size (e.g. 150%)Try it
initialResets to normalTry it
inheritInherits from the parent elementTry it

How to Use line-height

Set readable leading once, preferably with a unitless number.

  1. Choose the text block (often body or p).
  2. Set line-height to a unitless value such as 1.5.
  3. Confirm it still looks good when font-size changes or zooms.
  4. Override on headings if you want tighter display type.
PieceRequired?Role
Text that wrapsYes (to see it)Multiple lines make spacing obvious
Unitless numberRecommendedScales with each element’s font size
Length / %OptionalCan surprise you when inherited by larger children
~1.5 for bodyAccessibility tipHelps paragraph reading comfort

Live Preview

Only line-height changes on the sample paragraph.

Unitless values like 1.5 are usually the safest default for body copy.

Sample paragraph

line-height: 1.5

CSS Examples

Each snippet focuses on line-height only. Use Try It Yourself for a live editor.

Example 1 — Default Leading

Use the browser and font default with normal.

CSS
<style>
  p {
    line-height: normal;
  }
</style>

<p>Far out in the uncharted backwaters of the Galaxy lies a small yellow sun.</p>
Try It Yourself

How It Works

  1. Use the keyword. line-height: normal is the initial value.
  2. Font can matter. Desktop browsers often land near 1.2, but it varies.
  3. Fine for demos. Many sites still override it for clearer body text.
  4. Compare next. A unitless 1.5 usually reads more comfortably.

Example 2 — Unitless 1.5

Multiply the element’s font size for predictable leading.

CSS
<style>
  p {
    line-height: 1.5;
  }
</style>

<p>Far out in the uncharted backwaters of the Galaxy lies a small yellow sun.</p>
Try It Yourself

How It Works

  1. Use a bare number. 1.5 means 1.5 × this element’s font size.
  2. Inherits as a factor. Children multiply by their font size, not a fixed pixel height.
  3. Good for body copy. Around 1.5 is a common accessible starting point.
  4. Preferred pattern. MDN recommends unitless values in most cases.

Example 3 — Why em Can Surprise

A length computes once, then children may inherit a height that is too small.

CSS
<style>
  div {
    font-size: 16px;
    line-height: 1.5em;
  }

  h1 {
    font-size: 32px;
  }
</style>

<div>
  <h1>Big heading</h1>
  <p>The heading may inherit a line-height computed from 16px, not 32px.</p>
</div>
Try It Yourself

How It Works

  1. Parent sets em. 1.5em of 16px becomes a fixed computed length (24px).
  2. Child inherits that length. The large h1 can get cramped leading.
  3. Percentages act similarly. They also resolve to a length before inheritance.
  4. Fix: use line-height: 1.5 (unitless) on the parent instead.

Edge Cases & Pitfalls

Most line-height bugs come from units and inheritance.

units

Prefer unitless numbers

em and % resolve to a length, then children inherit that length. Unitless values keep multiplying each element’s own font size.

a11y

Body text needs room

Very tight leading makes long paragraphs hard to follow. About 1.5 or more is a solid accessibility baseline for main copy.

font

normal is not one fixed number

Browsers often use ~1.2, but the exact result can depend on the font-family.

shorthand

font can set it too

font: 16px/1.5 sans-serif sets size, line-height, and family together via the font shorthand.

letter

Not letter spacing

Gaps between characters belong to letter-spacing. Line-height is about line boxes.

Browser Support

line-height is a browser CSS property for typography. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

line-height

normal, unitless numbers, lengths, and percentages are widely supported in all modern browsers.

100% Common values
Google Chrome All versions
Full support
Mozilla Firefox All versions
Full support
Apple Safari All versions
Full support
Microsoft Edge All versions
Full support
Opera All versions
Full support
Samsung Internet All versions
Full support
Internet Explorer All versions
Full support
line-height Widely supported

Bottom line: Safe everywhere. Prefer unitless numbers for inherited body text. It is not a runtime API.

Key Takeaways

  • Role: set the height of line boxes — the space between lines of text.
  • Initial value: normal. Inherited.
  • Best practice: use unitless numbers such as 1.5.
  • Accessibility: keep main paragraphs near 1.5 or above.

One line: line-height: 1.5 is the simple, scalable way to give body text comfortable leading.

Frequently Asked Questions

It sets the height of each line box for text. In horizontal writing modes, that mainly controls the vertical space between lines.
The initial value is normal. Desktop browsers often treat that as roughly 1.2, depending on the font.
A unitless value multiplies each element’s own font-size and inherits more predictably. Lengths and percentages can leave child headings with the parent’s computed height.
Yes. Setting it on body or a container affects nested text unless a child overrides it.
For main paragraph content, aim for at least about 1.5 so low-vision and dyslexic readers can follow lines more easily.
It is Baseline and widely available. It is a browser CSS property, not a Node.js feature.

Next: list-style

Learn the shorthand for list markers, position, and image.

list-style tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful