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.
Fundamentals
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.
Foundation
📝 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.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
normal
Applies to
All elements
Inherited
Yes
Animatable
Yes, as a number, length, or percentage
Common use
Body text, articles, forms, and multi-line UI labels
Reference
💎 Property Values
Value
Example
Meaning
Number (unitless)
line-height: 1.5;
Multiplied by font size; 1.5 times the font size
Length
line-height: 24px;
Fixed line box height in px, em, rem, etc.
Percentage
line-height: 150%;
150% of the element’s font size
normal
line-height: normal;
Browser default, usually around 1.2
inherit
line-height: inherit;
Inherits the value from the parent element
normal1.624px150%
Default
🎯 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.
Preview
👀 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.
Hands-On
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>
This is an example of a paragraph with a line height of 1.6 times the font size. Adjusting the line height can make the text more readable and improve the overall design of your web page.
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.
Every paragraph inherits the same comfortable line height from the body element, keeping your typography consistent site-wide.
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.
A11y
♿ 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.
Compatibility
🖥 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 ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Legacy & Chromium
Full support
OperaAll versions · Modern & legacy
Full support
line-height property99% supported
Bottom line: Safe to use everywhere. Preview long paragraphs in your target browsers to confirm the spacing feels right.
Wrap Up
🎉 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.