CSS line-height Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Typography

What You’ll Learn

The line-height property controls vertical spacing between lines of text. It is one of the most important CSS properties for readable body copy and balanced typography.

01

Line Gap

Space between lines.

02

Syntax

Number, length, %.

03

Unitless

Best for body text.

04

normal

Browser default.

05

Inherited

Set on a parent.

06

Readability

Articles and UI text.

Introduction

The line-height property in CSS is used to control the amount of space between lines of text within an element. It plays a crucial role in enhancing the readability and visual appeal of text by managing vertical spacing.

This property can be used with various units and values to achieve different spacing effects. You will use it on paragraphs, articles, headings, buttons, and any block of text where comfortable reading matters.

Definition and Usage

Apply line-height to text containers such as p, article, li, or body. For body copy, unitless values between 1.5 and 1.7 are a common starting point.

💡
Beginner Tip

Prefer unitless numbers like 1.6 instead of 24px. They multiply by the element’s font size and inherit more cleanly to child elements.

📝 Syntax

The syntax for the line-height property is as follows:

syntax.css
selector {
  line-height: value;
}

Basic Example

line-height.css
p {
  line-height: 1.6;
}

Syntax Rules

  • The value can be a number, a length, a percentage, or the keyword normal.
  • Unitless numbers multiply by the element’s computed font size.
  • Length values such as px or rem set a fixed line box height.
  • Percentages are relative to the element’s font size.
  • The property is inherited by child elements.

⚡ Quick Reference

QuestionAnswer
Initial valuenormal
Applies toAll elements
InheritedYes
AnimatableYes, as a number, length, or percentage
Common useBody text, articles, forms, and multi-line UI labels

💎 Property Values

ValueExampleMeaning
Number (unitless)line-height: 1.5;Multiplied by font size; 1.5 times the font size
Lengthline-height: 24px;Fixed line box height in px, em, rem, etc.
Percentageline-height: 150%;150% of the element’s font size
normalline-height: normal;Browser default, usually around 1.2
inheritline-height: inherit;Inherits the value from the parent element
normal 1.6 24px 150%

🎯 Default Value

The default value of the line-height property is normal, which is determined by the browser and typically around 1.2 times the font size. This value may vary based on the font and the browser’s default settings.

You only need to set line-height when you want tighter headings, more breathable body copy, or consistent vertical rhythm across your design system.

👀 Live Preview

The same paragraph text with tight, comfortable, and loose line heights:

1.2 — tight

Good typography makes content easier to read. Line height controls the vertical space between each line of text.

1.6 — comfortable

Good typography makes content easier to read. Line height controls the vertical space between each line of text.

2 — loose

Good typography makes content easier to read. Line height controls the vertical space between each line of text.

Examples Gallery

Set readable body text, compare tight and loose spacing, use unitless values on headings, and store line height in a CSS variable.

🔢 Readable Body Text

Start with the reference example — set paragraph line height to 1.6 times the font size.

Example 1 — Paragraph with line-height: 1.6

Set the line height of a paragraph to 1.6 times the font size for comfortable reading.

line-height.html
<style>
  p {
    line-height: 1.6;
  }
</style>

<h1>Paragraph with Custom Line Height</h1>
<p>
  This is an example of a paragraph with a line height of 1.6 times the font size.
</p>
Try It Yourself

How It Works

The unitless value 1.6 multiplies the paragraph’s font size, creating consistent vertical spacing that scales if the font size changes.

Example 2 — Tight vs Loose Comparison

Compare different line heights side by side to see how they affect readability.

line-height-compare.css
.tight { line-height: 1.2; }
.comfortable { line-height: 1.6; }
.loose { line-height: 2; }
Try It Yourself

How It Works

Lower values pack lines closer together. Higher values add more vertical space. Body text usually feels best between 1.5 and 1.7.

🎨 Headings & Design Systems

Use tighter line height on headings and store body rhythm in CSS variables.

Example 3 — Heading vs Body Line Height

Headings often use tighter line height than body paragraphs.

line-height-heading.css
h1 {
  font-size: 2rem;
  line-height: 1.2;
}

p {
  line-height: 1.65;
}
Try It Yourself

How It Works

Multi-line headings stay compact with 1.2, while paragraphs breathe with a higher value like 1.65.

Example 4 — Theme Variable on body

Define a global line-height token for consistent typography across your site.

line-height-var.css
:root {
  --body-leading: 1.6;
}

body {
  line-height: var(--body-leading);
}
Try It Yourself

How It Works

Setting line-height on body with a CSS variable gives all text a shared vertical rhythm. Update one token to adjust the whole site.

♿ Accessibility

  • Aim for readable body text — Very tight line height makes paragraphs harder to track, especially for low-vision readers.
  • Test with zoom — Line height should still feel comfortable when users enlarge text.
  • Pair with adequate font size — Small text needs generous line height more than large display text.
  • Do not rely on spacing alone — Structure, contrast, and semantic headings matter too.
  • Watch multi-line buttons and labels — UI text also benefits from comfortable line height.

🧠 How line-height Works

1

You set a spacing value

Apply line-height with normal, a unitless number, length, or percentage.

CSS rule
2

Browser calculates line boxes

Each line of text gets a line box whose height is based on your value and the font size.

Layout
3

Inheritance spreads the rhythm

Child elements inherit the line height unless they define their own value.

Cascade
=

Readable vertical rhythm

Text becomes easier to scan, especially in articles, docs, and long-form content.

🖥 Browser Compatibility

The line-height property is widely supported across all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. It is a fundamental CSS property and should work consistently regardless of the browser.

Universal · All browsers

Core typography everywhere

line-height has been supported since the earliest CSS versions. You can rely on it in any web project.

99% Global browser support
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Legacy & Chromium
Full support
Opera All versions · Modern & legacy
Full support
line-height property 99% supported

Bottom line: Safe to use everywhere. Preview long paragraphs in your target browsers to confirm the spacing feels right.

🎉 Conclusion

The line-height property is a simple yet powerful tool for controlling the spacing between lines of text in your web design. By adjusting line height, you can improve the readability of your content and create a more aesthetically pleasing layout.

Experiment with different values to find the perfect balance for your design. Start with unitless numbers around 1.6 for body text, then fine-tune headings and UI labels as needed.

💡 Best Practices

✅ Do

  • Use unitless values like 1.5 to 1.7 for body text
  • Set a global line height on body for consistency
  • Use tighter values on large headings
  • Store typography tokens in CSS variables
  • Test readability on mobile and desktop

❌ Don’t

  • Cram long paragraphs with very tight line height
  • Rely on fixed pixel values when text size changes often
  • Confuse line-height with letter-spacing
  • Use the same line height for every text size without testing
  • Forget line height on multi-line buttons and form labels

Key Takeaways

Knowledge Unlocked

Five things to remember about line-height

Use these points when styling text with CSS.

5
Core concepts
normal 02

Default normal

Browser default.

Default
1.6 03

Unitless best

Scales with text.

Values
body 04

Inherited

Set on parent.

Pattern
05

Readability

Comfort matters.

A11y

❓ Frequently Asked Questions

The line-height property controls the amount of space between lines of text within an element. It affects vertical rhythm and readability.
The default value is normal, which is determined by the browser and is typically around 1.2 times the font size, depending on the font.
Prefer unitless numbers such as 1.5 or 1.6. They scale with font size and inherit more predictably than fixed pixel values.
Yes. line-height is inherited, so setting it on body or a parent container affects nested text unless a child overrides it.
line-height controls vertical space between lines of text. letter-spacing controls horizontal space between individual characters.

Practice in the Live Editor

Open the HTML editor, adjust line-height on paragraphs and headings, and preview readability instantly.

HTML Editor →

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.

5 people found this page helpful