Sub topic 3
Body text: choosing the baseline
This chapter assumes you know the basic vocabulary of type (typeface, font size, weight, italic) and can read simple CSS. Body text is the running text of paragraphs. It makes up most of a page, so it sets the baseline against which every other level is measured. Pick it first, and the rest of the hierarchy follows from it.
Why body text comes first
A headline is large only compared with the text around it. If you choose heading sizes before the body size, you end up adjusting everything again when the body changes. Fixing the body size first gives you one stable reference value.
Choosing the size
On screens, 16px (1rem in most browsers) is the usual minimum for long reading. Smaller text strains readers, especially on phones. Printed layouts often use 9 to 11 points, because paper is held closer and has higher resolution.
Set the size in rem, not in fixed pixels. A rem is relative to the browser's root font size, so it respects a user who has increased their default text size.
Choosing a typeface for reading
Body text needs a typeface that stays clear at small sizes over many lines. Look for these traits:
- A generous x-height (the height of lowercase letters such as "x"), which keeps letters open and easy to tell apart.
- Even spacing and sturdy strokes at 16px.
- A regular weight (400) with a matching italic and bold in the same family.
Typefaces designed for display use, with thin strokes or tight spacing, often fail here. You can use them for headlines instead.
A baseline you can run
This example sets the body baseline and the two properties that most affect comfort: line height and line length.
:root {
--step-0: 1rem;
}
body {
font-family: Georgia, serif;
font-size: var(--step-0);
line-height: 1.5;
color: #222;
}
p {
max-width: 65ch;
}The --step-0 variable names the baseline. Later chapters build the other steps from it. Line height is 1.5 with no unit, so it scales with whatever font size an element has. A value with a unit, such as 24px, would not scale. The 65ch limit keeps lines near 65 characters, since ch is roughly the width of the digit "0" in the current font.
Common errors
| Error | Result | Fix |
|---|---|---|
| Body text under 16px on screen | Tiring to read, poor on phones | Start at 1rem |
| Size set in `px` | Ignores user text-size settings | Use `rem` |
| Pure black on pure white | Harsh glare over long passages | Use a dark gray such as `#222` |
| Display typeface for body | Letters blur at small sizes | Reserve it for headlines |
| Changing body size per page | Hierarchy differs across the site | Define it once on `body` |
Checking your baseline
Read a few hundred words in your chosen setup, on the device your readers will most likely use. If you notice the typography, something is wrong. Good body text goes unnoticed because it lets the reader focus on the content.
Because every other level is a multiple of this size, treat it as a decision to make deliberately. Once it is set, resist small changes, since each one shifts the whole scale.
Exercise
A designer sets body text at font-size: 14px and line-height: 24px, then increases a heading to 28px. Name two problems with the body settings and give the corrected CSS.
Show answer
The size is below the 16px screen minimum and is fixed in pixels, so it ignores user text-size settings. The line height uses a unit, so it will not scale if the font size changes. Corrected CSS: body { font-size: 1rem; line-height: 1.5; }.
Exercise
Why is body text chosen before headlines when you build a hierarchy?
Show answer
Heading sizes are derived from the body size through the type scale. Fixing the body size first gives every other level a stable reference, so you do not have to rework the headings when the body size changes.