Hierarchy and Scale

Typography Fundamentals

Course 1 · Chapter 4 · Hierarchy and Scale

In Typography Fundamentals 3 you learned the four dials that make a single paragraph comfortable: size, measure, leading and tracking. A real page is never one paragraph, though. It has a title, section headings, captions, lists and notes, and the reader needs to know at a glance which is which. That job is called typographic hierarchy: using visible differences to show which text is most important, which belongs to which, and in what order to read it. This chapter shows how to build a hierarchy deliberately, using a modular scale to choose sizes and four kinds of contrast to separate the levels.

What was run, and what was not
The two Python scripts in this chapter were run on Windows with Python 3.14.0, using only the standard library. The output shown is exactly what they printed. The specimens on the page are live text styled in your browser; the CSS snippets were not tested across several browsers.

What a Hierarchy Is For

Imagine a page where every line is 16px regular text with the same gap between lines. Nothing tells you where to start, what is a heading and what is a footnote. You are forced to read it all to find out. Now imagine a menu, a timetable or a newspaper: you glance, find the big thing, then the next biggest, and decide where to dive in. A hierarchy is that glance made possible. A good one answers three questions without the reader noticing they were asked:

  • What is this page about? The title is the loudest thing.
  • How is it organised? Headings and subheads show the sections and their parts.
  • What is secondary? Captions, notes and metadata are visibly quieter than the main text.

Here is the same content set twice. Cover the right-hand sample and try to answer the three questions from the left one:

Flat: one size, one weight

Harbour Bread Club

Meet on the first Saturday of the month

What we bake

Sourdough, rye and a seasonal loaf. Bring a starter if you have one.

Photo: last month's table

Ranked: size, weight, colour, space

Harbour Bread Club

Meet on the first Saturday of the month

What we bake

Sourdough, rye and a seasonal loaf. Bring a starter if you have one.

Photo: last month's table

The right-hand sample uses no new typeface and no decoration. It simply made the title big and bold, pushed the tagline back with a softer colour, gave the section heading its own size and a gap above it, and shrank the caption. That is hierarchy.

The Four Tools of Contrast

To make one level stand apart from its neighbour, you vary something. There are four main things to vary, and a good designer picks one or two per level rather than all four at once.

ToolHow it signals rankCSS you would touchWatch out for
SizeBigger reads as more importantfont-sizeNeighbouring levels only 1 to 2px apart look like a mistake, not a choice
WeightBolder reads as more important or as a labelfont-weightBold everywhere stops meaning anything; remember the weights from Typography Fundamentals 2
Colour and toneStronger tone leads; softer tone recedescolorGrey text can become too faint to read: contrast is measured in Typography Fundamentals 7
SpaceSpace around text isolates it and groups what is nearmargin, padding, line-heightEqual space above and below a heading leaves it floating

A fifth tool exists, style (italic, small capitals, all-caps with tracking, as you saw in Typography Fundamentals 3), and a sixth, position (top of the page, left of the column). They are useful, but size, weight, colour and space do most of the work.

Space is the quiet tool
Beginners reach for size and bold first. Experienced designers often reach for space first. A heading with a generous gap above it and a small gap below it needs hardly any extra size to be clear, because the gaps show that it belongs to the paragraph that follows. Use space to group, and size and weight to rank.

Proximity: Space That Groups

Our eyes treat things that sit close together as related. This is called proximity, and it is why the gap above a heading should be larger than the gap below it. Compare the two headings below. In the first the gaps are equal; in the second the heading is pulled towards its own paragraph:

Equal gaps: the heading floats

The oven should be hot before the loaf goes in, and the steam tray filled.

Scoring the loaf

A single curved cut lets the bread expand where you choose.

Bigger gap above: the heading belongs

The oven should be hot before the loaf goes in, and the steam tray filled.

Scoring the loaf

A single curved cut lets the bread expand where you choose.

A handy rule of thumb is a gap above a heading of about 1.5 to 3 times the gap below it (check), but trust your eye over the number.

The Levels of a Page

Most pages need only four to six levels. Giving each a name and a job keeps the design honest:

LevelJobHTMLTypical treatment
TitleNames the page; only one per pageh1Largest, bold, tight leading
Lead or standfirstOne or two sentences that summarisep with a classA step above body, softer tone
HeadingOpens a main sectionh2Clearly bigger than body, bold, large gap above
SubheadSplits a section into partsh3Smaller than a heading; often only bold at body size, or a little larger
BodyThe main reading textp, liThe baseline against which everything else is judged
Caption or noteDescribes a figure or adds a side remarkfigcaption, smallSmaller and quieter than body
Choose the tag for meaning, the style for looks
Use h1 to h3 because of a heading's place in the outline, so screen readers and search engines understand the page, not because you like the default size. Never skip from h1 straight to h4 just to get a smaller heading: change the size in CSS instead.

Modular Scales: Picking Sizes by Ratio

How big should a heading be? "A bit bigger" is vague, and ad-hoc numbers (22px here, 27px there) tend to produce sizes that do not feel related. A modular scale removes the guesswork. You choose a base size (usually the body text, say 16px) and a ratio, then every other size is the base multiplied by the ratio a number of times. Going up is multiplying, going down is dividing:

size at step n = base × ration step 0 = the base (body text) step 1 = base × ratio (a lead paragraph, or a subhead) step 2 = base × ratio × ratio step -1 = base ÷ ratio (a caption)

This is borrowed from music, where each note on a scale stands in a fixed ratio to the next (check), which is why the ratios carry musical names. The reason it works is the same: sizes that share a ratio feel like they belong to one family. Some common ratios:

RatioNameCharacter
1.125Major secondSubtle: good for dense interfaces and long documents
1.2Minor thirdGentle and flexible: a safe default for articles
1.25Major thirdClear steps without shouting: a popular default
1.333Perfect fourthBold: good for marketing pages and posters
1.5Perfect fifthDramatic: few levels, big contrast
1.618Golden ratioVery steep: sizes explode after a few steps

Rather than trust the table, let us compute. This script prints the sizes five different ratios produce from a 16px base, then turns the minor-third scale into rem values for named roles.

"""Modular scales: one base size, one ratio, every other size follows. py scale.py """ BASE_PX = 16 RATIOS = {"major second": 1.125, "minor third": 1.2, "major third": 1.25, "perfect fourth": 1.333, "golden ratio": 1.618} print(f"{'step':>5}" + "".join(f"{name:>16}" for name in RATIOS)) for step in range(-2, 7): row = f"{step:>5}" for ratio in RATIOS.values(): row += f"{BASE_PX * ratio ** step:>14.1f}px" print(row) print() print("Minor third in rem (base 16px):") for step, role in [(-1, "caption"), (0, "body"), (1, "lead"), (2, "h3"), (3, "h2"), (4, "h1")]: px = BASE_PX * 1.2 ** step print(f" step {step:>2} {role:<8} {px / BASE_PX:.3f}rem ({px:.1f}px)")
step major second minor third major third perfect fourth golden ratio -2 12.6px 11.1px 10.2px 9.0px 6.1px -1 14.2px 13.3px 12.8px 12.0px 9.9px 0 16.0px 16.0px 16.0px 16.0px 16.0px 1 18.0px 19.2px 20.0px 21.3px 25.9px 2 20.2px 23.0px 25.0px 28.4px 41.9px 3 22.8px 27.6px 31.2px 37.9px 67.8px 4 25.6px 33.2px 39.1px 50.5px 109.7px 5 28.8px 39.8px 48.8px 67.3px 177.4px 6 32.4px 47.8px 61.0px 89.8px 287.1px Minor third in rem (base 16px): step -1 caption 0.833rem (13.3px) step 0 body 1.000rem (16.0px) step 1 lead 1.200rem (19.2px) step 2 h3 1.440rem (23.0px) step 3 h2 1.728rem (27.6px) step 4 h1 2.074rem (33.2px)

Read down the columns. The major second grows gently: even step 6 is only 32.4px, which is why it suits long documents. The golden ratio reaches 109.7px at step 4 and 287.1px at step 6, far too large for a normal page, while its step -2 is a useless 6.1px. The lesson is that a bigger ratio gives you fewer usable steps. For most text-heavy pages, a ratio between 1.125 and 1.333 and only four to six steps is plenty (check).

Notice also that the small side of the scale shrinks quickly: with the perfect fourth, step -2 is 9.0px, below a comfortable reading size. A scale does not have to be used in both directions. Many designs use the base for body text and only one step down for captions.

Common mistake
Following the scale blindly. A modular scale gives you good candidates, not commandments. If a computed size looks wrong next to a real typeface (a heading at 27.6px that is a hair too small, say), nudge it or pick a different step. Also, a scale tells you nothing about weight, colour or space, so it solves only one fifth of a hierarchy.

Putting a Scale into CSS

Custom properties (CSS variables) are the natural home for a scale: define the sizes once, then use them by name everywhere. Changing the ratio later means editing a few lines. Sizes are in rem so they follow the reader's browser setting (Typography Fundamentals 3).

:root { /* Scale: base 1rem, ratio 1.25 (major third) */ --size-caption: 0.8rem; --size-body: 1rem; --size-lead: 1.25rem; --size-h3: 1.563rem; --size-h2: 1.953rem; --size-h1: 2.441rem; } body { font-size: var(--size-body); line-height: 1.55; } h1 { font-size: var(--size-h1); line-height: 1.15; margin: 0 0 0.75rem; } h2 { font-size: var(--size-h2); line-height: 1.2; margin: 2.5rem 0 0.75rem; } h3 { font-size: var(--size-h3); line-height: 1.25; margin: 2rem 0 0.5rem; } .lead { font-size: var(--size-lead); color: #55555e; } figcaption { font-size: var(--size-caption); color: #55555e; }

Notice how this stylesheet uses all four tools: size from the scale, a tighter line-height as the text grows (Typography Fundamentals 3), colour on the lead and caption, and margins that are larger above a heading than below it.

Auditing a Hierarchy

You can check a hierarchy by looking, and you should. But a quick script catches the commonest fault, levels that are too close to tell apart. This audit takes a list of levels with size and weight, computes the size ratio between each level and the next, and flags pairs that are too close in size and not rescued by a big difference in weight. The 1.15 threshold is a rule of thumb, not a law (check).

"""Hierarchy audit: do neighbouring levels differ enough to be told apart? py audit.py """ LEVELS = [ # role, size in px, weight ("h1", 22, 700), ("h2", 20, 700), ("h3", 18, 700), ("body", 16, 400), ("caption", 15, 400), ] MIN_RATIO = 1.15 # a rule of thumb, not a law (check) print(f"{'role':<9}{'size':>6}{'weight':>8}{'ratio to next':>15} verdict") for i, (role, size, weight) in enumerate(LEVELS): if i + 1 < len(LEVELS): nxt_size, nxt_weight = LEVELS[i + 1][1], LEVELS[i + 1][2] ratio = size / nxt_size bolder = weight - nxt_weight >= 300 if ratio >= MIN_RATIO: verdict = "clear" elif bolder: verdict = "close in size, saved by weight" else: verdict = "too close: add size, weight or space" print(f"{role:<9}{size:>6}{weight:>8}{ratio:>15.2f} {verdict}") else: print(f"{role:<9}{size:>6}{weight:>8}{'-':>15} (last level)")
role size weight ratio to next verdict h1 22 700 1.10 too close: add size, weight or space h2 20 700 1.11 too close: add size, weight or space h3 18 700 1.12 close in size, saved by weight body 16 400 1.07 too close: add size, weight or space caption 15 400 - (last level)

The audit says the title and the headings are nearly the same size and the same weight: the page would read as a pile of similar-looking headings. The h3 is saved by being bold against regular body text, but the body and caption are only 1px apart with the same weight, so a caption would look like a typing slip, not a different level. The cure is a scale: moving this page to a 1.25 ratio would put the title at about 39px, the headings at about 31px and the subheads at 25px, and the audit would pass them all.

What the numbers cannot tell you
The script only compares sizes and weights. It cannot tell you whether a grey is too pale, whether the gaps group the right things, or whether the page feels organised. Use it as a smoke alarm, then squint at the page: if blurring your eyes still shows the same order of importance, the hierarchy is working.

Building a Readable Page Structure

Here is a short recipe for putting it all together, in the order a designer would work:

  1. Start with the body. Choose its typeface, size, measure and leading (Typography Fundamentals 3). Everything else is measured from it.
  2. List the levels you really need. Title, lead, heading, subhead, caption is usually enough. Fewer levels, more clearly separated, beats many levels that blur together.
  3. Pick a scale and assign steps to levels. Nudge by eye.
  4. Add weight and tone where size alone is not enough, for instance bold subheads at body size, or a softer colour for captions.
  5. Set the space so headings sit closer to what follows than to what precedes them.
  6. Squint test. Blur your eyes or shrink the page: the order should still be obvious.
Idea in this chapterAn idea you may already know
Modular scaleSpacing tokens or a colour palette in a design system: a few related values reused everywhere
Hierarchy levelsThe headings outline of an HTML document: h1 to h3 nested by meaning
ProximityA well-grouped menu or a form with fieldsets: things near each other belong together
Squint testReading code at a glance by its indentation, not its words

Hands-On Exercises

Three exercises: a code task that turns a scale into CSS, a written design task that gives a flat page its hierarchy, and a CSS task that builds a complete stylesheet from a scale. Each has a solution file that opens in a new tab.

Exercise 1

Write a script that takes a base size and a ratio from the command line and prints a :root block of CSS custom properties for six named roles (caption, body, lead, h3, h2, h1) in rem, with a comment showing the pixel size beside each. Make it print a warning when the caption comes out below 12px or the h1 above 64px. Try it with 1.25 and with 1.618 and describe in a sentence what changes.

📄 View solution
Exercise 2

A community recipe page is set entirely in 16px regular text, one colour, with equal gaps between every line. It has a recipe title, a one-sentence intro, the headings "Ingredients" and "Method", a list of ingredients, numbered method steps, a "chef's tip" and a photo caption. On paper, design its hierarchy: for each element give a size (in rem), weight, colour tone and the space above and below it. For each level say which of the four tools (size, weight, colour, space) you chose and why, and explain how your spacing shows that "Method" belongs to the steps beneath it and not to the ingredients above it.

📄 View solution
Exercise 3

Write a stylesheet for a long-form article that defines its type sizes as custom properties from a modular scale (state your base and ratio in a comment). Include a small kicker label above the title, a lead paragraph, h1 to h3, body text and a figure caption. Use all four tools of contrast, with a comment on each rule saying which tool carries the rank. Give headings more space above than below, and add a media query for wide screens that changes only the root font size, with a comment explaining why that is enough.

📄 View solution

Chapter 4 Quick Reference

  • Hierarchy shows what is most important, how the page is organised and what is secondary; four to six levels is usually enough
  • Four tools of contrast: size, weight, colour and tone, space; use one or two per level, not all four at once
  • Proximity: more space above a heading than below it, so it groups with what follows (about 1.5 to 3 times (check))
  • Modular scale: size = base × ratiostep; ratios between 1.125 and 1.333 suit most text pages (check); bigger ratios give fewer usable steps
  • In CSS: store the scale in custom properties, in rem; use a tighter line-height on bigger text
  • Tags for meaning, CSS for looks: do not skip heading levels to get a smaller size
  • Squint test: blur the page; the order of importance should still show