Sub topic 8
Line Height for Readable Paragraphs
Line height, called leading in print, is the distance from one baseline to the next in a block of text. It decides how much white space sits between lines. This chapter assumes you know the basic type vocabulary (typeface, font size, weight, italic) and can read simple CSS. It covers how to choose line height for body text and headlines, how to write it in CSS, and the errors that most often break it.
Why line height matters for hierarchy
Body text is the baseline of a hierarchy. If the paragraphs are tiring to read, no choice of headline size will rescue the page. Line height shapes how the eye travels. At the end of each line, the reader must jump back to the start of the next one. If the lines are too close together, the eye lands on the wrong line, or the ascenders and descenders of neighboring lines crowd each other. If the lines are too far apart, the paragraph breaks into separate strips and the eye loses the sense of a single block.
Line height also affects hierarchy directly. A headline and a paragraph in the same layout need different leading. The difference helps the reader see them as different kinds of text.
The working model
Think of each line of text as sitting in a horizontal box. The font size sets the height of the type, and the line height sets the height of the box. The extra space is split evenly above and below the text. This is called half-leading.
With a 16px font and a line height of 1.5, each line box is 24px tall. The 8px of extra space is divided into 4px above and 4px below. Because the space is shared evenly, the first line of a paragraph also gets some space above it. Keep this in mind when you align text to other elements.
Choosing a value for body text
A good starting point for body text is a line height between 1.4 and 1.6 times the font size. The spine's example uses 1.5. WCAG 2.1 success criterion 1.4.12 (Text Spacing) says that content must remain usable when a user sets line height to at least 1.5 times the font size. Setting 1.5 as your default means your design already works at that level.
Several factors move the best value up or down:
- Line length. Long lines need more leading, because the eye needs a clear guide back to the next line. Short lines can use less.
- Typeface. Fonts with a large x-height (the height of lowercase letters such as x) look denser and need more leading. Fonts with small x-heights can use less.
- Font size. Small text often needs relatively more leading. Large text needs relatively less.
- Weight. Heavy text looks darker on the page and benefits from a little more space.
- Language and script. Scripts with tall marks or stacked accents often need extra room.
| Text role | Typical line height | Reason |
|---|---|---|
| Body paragraph | 1.4 to 1.6 | Comfortable return from line end to next line |
| Small caption or footnote | 1.4 to 1.5 | Small size needs relatively more room |
| Subhead (one or two lines) | 1.25 to 1.35 | Short text, so tighter spacing still reads well |
| Large headline | 1.1 to 1.25 | Big size makes the default gap look too loose |
Unitless values
In CSS you can write line height in several ways. The unitless number is almost always the right one.
.a { line-height: 1.5; } /* number: multiplier of the element's own font size */
.b { line-height: 150%; } /* percentage: computed once, then inherited as pixels */
.c { line-height: 1.5em; } /* em: computed once, then inherited as pixels */
.d { line-height: 24px; } /* fixed length */The difference appears when a child element has a different font size. A unitless number is inherited as the number itself, so each child recalculates it from its own font size. A percentage or em value is converted to a length at the parent and that fixed length is inherited. Here is a case where this matters:
<style>
.box-percent { font-size: 16px; line-height: 150%; }
.box-number { font-size: 16px; line-height: 1.5; }
.box-percent small, .box-number small { font-size: 32px; }
</style>
<div class="box-percent">
Parent text <small>Large child</small>
</div>
<div class="box-number">
Parent text <small>Large child</small>
</div>In the first box, the child inherits 24px (150% of 16px). A 32px child with a 24px line height overflows its line, and lines can collide. In the second box, the child inherits the number 1.5 and gets 48px, which fits. Unitless values scale correctly when font sizes change, which is exactly what you want in a type scale.
Tightening leading for headlines
Leading that looks right for body text looks loose on a large headline. At 39px, a line height of 1.5 gives a 58px line box, and a two-line headline separates into two loose lines. Reduce the value as size grows. The spine's second example does this.
body {
font-family: Georgia, serif;
font-size: 1rem;
line-height: 1.5;
}
p {
max-width: 65ch;
}
h1 {
font-size: 2.441rem;
line-height: 1.15;
font-weight: 700;
}The h1 has a line height of 1.15, which gives about 45px of line box for a 39px font. The headline is a short block, often one to three lines, so tight leading holds it together as one shape. Body text is a long block, so it needs room.
Do not go below about 1.0 for text that wraps. At or below 1.0, ascenders on one line can touch descenders on the line above. All-caps headlines can go tighter, since they have no descenders, but check the actual result.
Leading and line length work together
Line length (measure) and leading are linked. The max-width: 65ch in the example limits a line to about 65 characters. Within that range, 1.5 works well. If a layout forces longer lines, such as 90 characters across a wide column, raise the leading to 1.6 or more. If a narrow column holds 35 characters, 1.35 or 1.4 can be enough. The best fix for long lines is shortening them, not adding leading, but the two adjustments support each other.
Spacing between paragraphs
Line height controls the space inside a paragraph. Space between paragraphs is a separate decision. Two common systems exist.
- Space between paragraphs, no indent. Add a margin equal to about one line. This is the usual choice on the web.
- Indent, no space. The first line of each new paragraph is indented by about 1em, and no gap is added. This is common in books.
Do not combine them. Using both adds two signals for one job. When you choose a gap, tie it to the line height so the vertical rhythm stays steady:
body {
font-size: 1rem;
line-height: 1.5;
}
p {
margin-top: 0;
margin-bottom: 1.5em; /* one line of body text */
}A margin of 1.5em matches one line box at the default size. A smaller gap, such as 0.75em, can work, but the paragraphs begin to look like continuous text. A much bigger gap makes the page look like a list of unrelated items.
Line height and headings in context
Line height and the margins around a heading work together. A subhead with a line height of 1.3 and a top margin of 2em reads as a clear break. A subhead with the same line height and equal space above and below floats between paragraphs. A later chapter covers spacing and proximity in detail. For now, remember that a heading's line height shapes the heading itself, while its margins shape its relationship to the text around it.
Common errors
- Fixed pixel line heights. Setting
line-height: 24pxonbodymeans every child inherits 24px, even when it has a much bigger font size. Use a unitless value. - One value for every level. Applying 1.6 to the headline makes it look loose and disconnected. Reduce it as size increases.
- Leading too tight on small text. Footnotes and captions at 0.8rem with a line height of 1.2 are hard to read. Keep 1.4 or more.
- Ignoring user settings. Some readers override line height through their browser or an extension. Avoid fixed-height containers, because enlarged text will overflow or be clipped. Use
min-heightor let the content size the box. - Compensating for a bad measure with leading. If lines run past 80 characters, fix the column width first.
- Mixing paragraph gap systems. Pick either margin or indent, not both.
Testing your line height
Check your values with a few quick tests.
- Print or view a paragraph at its real size and look at it from arm's length. The text should look like an even gray block with no dark or light bands.
- Read a full paragraph. Notice whether you ever lose your place when moving to the next line.
- Use browser developer tools to set
line-heightto 1.2 and then 1.8 on the same paragraph. Seeing both extremes makes the right middle value easier to judge. - Apply a text spacing override of 1.5 line height and check that nothing overlaps or clips.
Putting it together
The next stylesheet combines the ideas of this chapter. It sets one default for body text and tightens it where size grows.
:root {
--leading-body: 1.5;
--leading-heading: 1.15;
--leading-subhead: 1.3;
}
body {
font-family: Georgia, serif;
font-size: 1rem;
line-height: var(--leading-body);
}
h1 {
font-size: 2.441rem;
line-height: var(--leading-heading);
}
h2 {
font-size: 1.563rem;
line-height: var(--leading-subhead);
margin-top: 2em;
margin-bottom: 0.5em;
}
p {
max-width: 65ch;
margin: 0 0 1.5em;
}Each level has its own named leading value, all unitless. If you later change the scale, the line boxes follow the new sizes automatically.
Exercise
A page sets body { font-size: 16px; line-height: 150%; }. A pull quote inside it uses font-size: 32px with no line-height rule of its own. Two-line quotes have lines that nearly touch. What is the cause, and how do you fix it for the whole page?
Show answer
A percentage line height is computed at the parent (16px x 150% = 24px) and the child inherits the fixed 24px. A 32px quote on a 24px line height has too little room. Change the body rule to a unitless value, line-height: 1.5. The quote then inherits the number and computes 32px x 1.5 = 48px. You can also set a tighter value such as 1.3 on the quote itself.
Exercise
A headline is 40px and wraps to two lines. At line-height 1.5 it looks like two separate lines. Give a better value, the resulting line box height, and the reason.
Show answer
Use about 1.15, which gives a line box of 46px (40 x 1.15). Large text has big letterforms, so the default gap looks loose, and a short block of one to three lines holds together better with tight leading.