Sub topic 13
Alignment and Grid Support for Hierarchy
Size, weight, and color rank text. Alignment and grid decide where the ranked text sits, and that placement either reinforces the ranking or undermines it. This chapter shows how a shared alignment edge and a column grid make a hierarchy readable at a glance, and the mistakes that weaken it.
Prerequisites
This chapter assumes you have read the earlier chapters on type scale, leading, measure, and spacing. You should know what a type scale is, why body text uses a line height near 1.5, and why a measure near 65 characters is comfortable. The code examples use basic HTML and CSS, including CSS Grid.
Why alignment supports hierarchy
Readers scan before they read. When headline, subheads, and paragraphs share one left edge, the eye follows that edge down the page and picks out the headings from the ragged right side of the text. Every deviation from the shared edge reads as a signal. If the signal is deliberate, such as an indented pull quote, it adds meaning. If it is accidental, it adds noise and makes the reader wonder what the offset means.
Alignment therefore works as a free hierarchy cue. It costs nothing in size or weight, so you can keep your scale restrained and still make the structure clear.
Choosing a text alignment
Four alignments are in common use. They differ in how well they preserve a stable edge and an even word rhythm.
| Alignment | Strength | Risk | Typical use |
|---|---|---|---|
| Left (ragged right) | Stable left edge, even word spacing | Very uneven rag if the measure is too narrow | Body text, subheads, most headlines |
| Centered | Formal, symmetrical feel | No shared edge, so the eye must find each line start | Short headlines, titles, captions |
| Right | Pairs a label with content on its left | Hard to read in more than a line or two | Numbers in tables, short labels |
| Justified | Clean block shape | Uneven word gaps and "rivers" of white space without hyphenation | Narrow-column print with hyphenation |
For left-to-right languages, default to left-aligned text. Center only text that is short enough to read in a single glance, and never center a multi-line paragraph. Centered paragraphs make the reader hunt for the start of each line.
Mixing alignments within one hierarchy is the most common error. A centered headline above left-aligned subheads and left-aligned body text creates two competing axes. If you want a centered headline, center the lead too, and keep the body text on a clean left edge under a deliberate gap.
The grid as a shared set of edges
A grid is a set of invisible columns, gutters, and margins that every element snaps to. For typography, its main job is to give headings and text the same few edges to align against.
A column grid has three parts:
- Columns hold content.
- Gutters are the fixed gaps between columns.
- Margins are the space between the grid and the page edge.
A 12-column grid is a popular choice because 12 divides evenly into 2, 3, 4, and 6. A text-heavy page rarely uses all 12 columns for body text. It typically spans a subset, such as 7 columns, which keeps the measure in a readable range and leaves space for notes or whitespace.
The measure and the grid are linked. Choose the column span so the resulting width produces about 65 characters per line at your body size. Then cap it with max-width: 65ch as a safeguard, so wide screens cannot stretch the line.
Worked example: a one-column article on a 12-column grid
This page places every element on the same starting column. Headings and paragraphs share their left edge, and only the pull quote deliberately steps off it.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Grid and hierarchy</title>
<style>
:root {
--u: 0.5rem;
}
body {
margin: 0;
font-family: Georgia, serif;
font-size: 1rem;
line-height: calc(var(--u) * 3);
}
.page {
display: grid;
grid-template-columns: repeat(12, 1fr);
column-gap: calc(var(--u) * 3);
max-width: 72rem;
margin-inline: auto;
padding-inline: calc(var(--u) * 3);
}
.page > * {
grid-column: 2 / span 7;
}
p { max-width: 65ch; margin: 0 0 calc(var(--u) * 3); }
h1 {
font-size: 2.441rem;
line-height: calc(var(--u) * 6);
margin: calc(var(--u) * 6) 0 calc(var(--u) * 3);
}
h2 {
font-size: 1.563rem;
line-height: calc(var(--u) * 4);
margin: calc(var(--u) * 5) 0 calc(var(--u) * 1);
}
.pull {
grid-column: 1 / span 8;
font-style: italic;
font-size: 1.25rem;
margin-block: calc(var(--u) * 3);
}
</style>
</head>
<body>
<article class="page">
<h1>Headline states the main idea</h1>
<p>Body text sits on the same left edge as every heading above and below it.</p>
<h2>Subhead introduces a section</h2>
<p>The subhead has more space above than below, so it belongs to this paragraph.</p>
<p class="pull">A deliberate offset marks this line as different.</p>
</article>
</body>
</html>Three details matter here:
.page > *sends every child to the same starting column, so the shared left edge is a rule and not something you maintain by hand.- The pull quote starts one column earlier, which is a visible and intentional break. One exception on a page reads as emphasis, and several exceptions read as disorder.
- All vertical values come from one unit,
--u. Line heights and margins are multiples of it, so the vertical spacing follows a consistent rhythm.
Vertical rhythm and the baseline grid
Horizontal alignment has a vertical counterpart. A baseline grid is a set of evenly spaced horizontal lines, and every line of text sits on one of them. When headings and paragraphs all follow the same line spacing, text in neighboring columns lines up across the page, and the page feels calm.
CSS has no native baseline grid, so web designers approximate one with a spacing unit. In the example above the unit is 0.5rem. Body lines are 3 units, the headline line is 6 units, and the subhead line is 4 units. Margins are whole units too.
This approach is a spacing system, not a strict lock. If a subhead wraps to two lines, the block height is no longer a multiple of the body line, and the following text drifts off the grid. You can accept the drift, shorten the headings, or use fixed heights. For most web pages the drift is acceptable. For print layouts and multi-column pages, where misaligned lines in adjacent columns are obvious, a strict baseline grid is worth the effort.
Common errors
- Centering long text. Center only short lines. A centered paragraph has no edge to follow.
- Mixing alignments at the same level. If some subheads are left-aligned and others centered, readers cannot tell whether the difference carries meaning.
- Justifying without hyphenation. Justified text in a narrow column produces wide gaps between words. If you justify on the web, add
hyphens: autoand alangattribute on the page. - Indenting subheads for emphasis. Indented subheads break the shared edge, and the reader starts to treat them as nested content. Use size and weight to rank headings, and keep the edge constant.
- Off-grid margins. Arbitrary values such as
margin-top: 37pxadd small mismatches that accumulate. Draw margins from the unit. - Letting the measure float. If a column spans the full width of a wide screen, the line length grows past a comfortable range. Keep the
65chcap.
Alignment in a responsive layout
On a narrow screen, the 12-column grid collapses to a single column. The shared left edge survives, because every element still starts at the same position. Use a media query to change the span, and keep the rule that all children start together.
@media (max-width: 40rem) {
.page {
grid-template-columns: 1fr;
}
.page > *,
.pull {
grid-column: 1;
}
}The pull quote loses its offset in this layout, because there is no spare column to step into. That is the right trade-off. A deliberate exception needs room to look deliberate, and when the room is gone, the exception should go too.
Checking alignment
Two quick checks catch most problems:
- Edge check. Draw a vertical line down the left side of the page. Every heading and paragraph should touch it, apart from intentional exceptions you can name.
- Squint check. Blur your eyes or the screenshot. You should see the headings as dark anchors on one edge, with the text as even gray blocks beneath them.
Exercise
A landing page has a centered headline, left-aligned subheads, and body paragraphs that are centered inside a 7-column block. List the alignment problems and give a fix for each.
Show answer
There are two problems. First, the centered body paragraphs have no shared left edge, so the reader must find the start of each line. Fix: left-align the paragraphs. Second, the page mixes a centered headline with left-aligned subheads, which creates two competing axes. Fix: left-align the headline so all three levels share one edge, or, if you keep a centered headline for effect, separate it clearly as a title block above the left-aligned content.
Exercise
Your body text has a 3-unit line height, where the unit is 0.5rem. A subhead has a 4-unit line height and a 1-unit bottom margin. What top margin, in units, keeps a one-line subhead and its margins aligned with the body line rhythm, and why might that alignment fail?
Show answer
The total block height must be a multiple of 3 units. The line and bottom margin add 5 units, so a top margin of 4 units gives 9, which is a multiple of 3. The alignment fails if the subhead wraps to two lines, because the line height then adds 8 units and the block becomes 13 units, which is not a multiple of 3. The following text drifts off the rhythm.