Sub topic 6
Subheads: structuring and scanning
This chapter assumes you know the basic vocabulary of type (typeface, size, weight, italic) and can read simple CSS and HTML. It also assumes you have met the idea of a type scale, where each level takes a fixed step up from the body size.
What subheads do
A subhead is a short heading that introduces one section of a page. The headline names the whole piece. Subheads break it into parts so a reader can see its shape before reading any of it.
Most readers scan before they commit. They run their eyes down the page, stopping at the largest or boldest items. If the subheads alone tell a rough story, the reader can find the section they need or decide the page is worth reading.
Subheads also serve a second group of readers. People who use screen readers often jump from heading to heading, so the structure has to exist in the markup and not only in the visuals.
Where subheads sit in the hierarchy
A subhead ranks below the headline and above body text. It needs a clear size step from each. With the 1.25 scale from the previous chapter, a level-two subhead uses --step-2 (1.563rem), which sits between the 1rem body and the large headline.
If the subhead is too close to body size, readers won't notice it. If it is too close to the headline, the two compete for first place.
Styling a subhead
Size is the first cue. Weight is a useful second one, because a semibold subhead stands out even when its size step is modest. Keep the cues few. Size plus weight is usually enough, and adding color, italics, and capitals as well tends to clutter the page.
h2 {
font-size: 1.563rem;
font-weight: 600;
margin-top: 2em;
margin-bottom: 0.5em;
}
h2 + p {
margin-top: 0;
}The margins matter as much as the size. The space above the subhead (2em) is four times the space below it (0.5em). That imbalance ties the subhead to the paragraph it introduces and separates it from the one before. The rule h2 + p removes the paragraph's own top margin, so the gap below the subhead stays exactly 0.5em.
Using semantic markup
Write each level with the matching heading element. CSS then styles each level, and assistive technology can list and navigate the headings.
<article>
<h1>Headline states the main idea</h1>
<p class="lead">A short intro sentence in slightly larger text.</p>
<h2>Subhead introduces a section</h2>
<p>Body text carries the detail.</p>
</article>Choose the element by the structure of the content. Don't choose it by how big you want the text to look. If you want a different size, change the CSS.
Writing subheads that scan well
Visual styling only helps if the words work too. Good subheads:
- Describe what the section says, not just its topic. "Margins tie a subhead to its text" tells more than "Margins".
- Stay short enough to fit on one line at typical widths.
- Use a consistent form, such as all noun phrases or all short statements.
Common errors
- Skipped levels. Jumping from
h1toh3breaks the outline for screen reader users. - Equal space above and below. The subhead floats between two paragraphs and belongs to neither.
- Too many levels. Three levels (headline, subhead, body) cover most pages. A fourth level should have a clear job.
- Styling body text as a heading. Bold paragraphs do not appear in a heading list.
Exercise
A subhead has margin-top: 0.5em and margin-bottom: 2em. What problem does this cause, and how do you fix it?
Show answer
The larger gap sits below the subhead, so it looks attached to the previous paragraph and separated from the text it introduces. Swap the values so the larger space is above (margin-top: 2em) and the smaller is below (margin-bottom: 0.5em).
Exercise
A page goes from an h1 straight to an h3 because the designer liked the h3 size. What is wrong, and what should they do instead?
Show answer
Skipping a level breaks the heading outline that assistive technology uses. They should use an h2 and change its size with CSS if they want a different look.