Line-height property

Last updated: 2026-09-13

line-height Line-height property

The line-height CSS property sets the vertical space between lines of text. A well-chosen line height significantly improves readability of long-form text, typically around 1.5 times the font size.

Category
Initial Valuenormal
InheritedYes
Applies Toall
Animation Typenumber
CSS VersionCSS1
StatusStandard

📝 Syntax

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

⚙️ Values

ValueTypeDescription
normalKeywordDefault line height (about 1.2)
<number>TypeA unitless multiplier, e.g. 1.5
<length> | <percentage>TypeA fixed line height as a length or percentage

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
line-height v1 v12 v1 v1 v1
Supported in all major browsers
Tip: Prefer unitless numbers (like 1.5): they scale with the font size and their inheritance behavior is more predictable.
Important: Unitless numbers and percentages inherit differently: a unitless number is inherited as a multiplier, while a percentage is resolved against the parent's font size and inherited as a fixed pixel value.

❓ FAQ

QHow do I vertically center a single line of text using CSS rules?
ASet line-height equal to the container's height, for example height: 40px; line-height: 40px, and the single line will be vertically centered. However, multi-line text will overflow, in which case you should switch to Flexbox with align-items: center.
QWhat line height should I use for readable body text on my website?
AFor body text, 1.5–1.8 times the font size is recommended; long-form reading benefits from 1.7–1.8, while headings can be tighter at 1.2–1.4. Code blocks often use 1.4–1.6. On mobile, where screens are narrower, line height usually needs to be slightly larger than on desktop.
QWhat is the difference between line-height: 1.5 and line-height: 150%?
AThe difference is inheritance. A unitless 1.5 is a multiplier, so children compute their line height from their own font size — predictable behavior. A percentage like 150% is resolved to a fixed pixel value against the parent's font size before being inherited, so it does not adjust when child font sizes change, which can cause problems.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏