Unitless value
A ratio like 1.6 scales with the current font size.
Line height controls vertical breathing room inside text. It can make paragraphs calm and readable or cramped and tiring.
body { line-height: 1.6; }
h1 { line-height: 1.05; }
Typography & Visual Style
line-height controls the distance between text lines. It affects paragraphs, headings, buttons, navigation and form labels.
A unitless line-height is usually best because it scales with the element font size. That means child elements inherit a flexible ratio instead of a fixed pixel value.
Headings often need tighter line-height. Body text usually needs more breathing room. Interface labels need enough height to remain legible without feeling loose.
A ratio like 1.6 scales with the current font size.
Long text usually needs more line-height than labels.
Large headings can use tighter line-height without becoming cramped.
line-height is inherited, so body choices affect many children.
Visual model
Typography and visual style are where CSS starts to feel like design. These models turn subjective choices into reusable decisions you can explain, test and improve.
Examples
body { line-height: 1.6; }
h1, h2 {
line-height: 1.05;
}
p {
font-size: 18px;
line-height: 18px;
}
Rules that matter
A beautiful one-off style is not enough. The goal is a visual system that keeps working when the site grows, content changes and new pages are added.
It scales more safely through inheritance.
Long reading text should not feel compressed.
Large type often needs less line-height than body copy.
A heading that looks good on one line may fail on two lines.
It can break when font size changes.
Small UI text still needs enough vertical room.
Production thinking
Line height is invisible until it is wrong. It has a huge effect on whether people keep reading.
Readable line height helps users with low vision, dyslexia and zoomed text settings.
Set sensible line-height defaults at body and heading levels, then override intentionally for components.
Comfortable reading supports longer visits and better content engagement.
Live code lab
The preview runs in an isolated iframe. Links and forms stay inside the practice area, so you can experiment without leaving the lesson.
Mini assignment
Practice assignment
Try it yourself
Self-check
Answer these questions before moving on. If your answer is vague, change the lab values and judge the visual result again.
Senior audit upgrade
Paragraph text usually needs relaxed line-height. Buttons and compact UI labels often need tighter values, but custom fonts can clip if you go too tight.
Use comfortable unitless line-height for reading.
Button text can be tighter, but height should still create a strong hit area.
Test ascenders, descenders and accents so text does not clip.