Sub topic 5
Multi-column grids
This chapter assumes you know the parts of a grid (margins, columns, gutters) and the basic typography terms point size, leading and line length. Basic CSS helps for the code examples. You can read the print sections without it.
What a multi-column grid is
A multi-column grid divides the live area of a page into vertical columns separated by gutters. The live area is the page minus its margins. Columns are the units you place content in, and gutters are the fixed gaps between them.
A single-column grid has one text block, as in a novel. A multi-column grid lets you mix content of different widths on one page: body text, a sidebar, a pull quote, a caption. Everything still lines up on shared vertical edges.
Two ideas matter most in this chapter:
- A column is a unit of placement, not necessarily a column of text. A 12-column grid does not mean twelve narrow text columns. It means content can start and end at any of thirteen vertical lines.
- Content spans one or more columns, and each span includes the gutters inside it.
Choosing the number of columns
The right count depends on how many different widths your content needs. Count how many different widths the design needs, then pick a column count that makes those widths easy to build.
| Columns | Typical use | Common splits |
|---|---|---|
| 1 | Books, long essays | Full width only |
| 2 | Reports, simple articles | 1 + 1, or 1 + 2 if unequal |
| 3 | Brochures, magazines | 1 + 2, 3 |
| 4 | Newsletters, small web layouts | 2 + 2, 1 + 3 |
| 6 | Magazines, editorial sites | 2 + 4, 3 + 3, 2 + 2 + 2 |
| 12 | Web frameworks, complex pages | 8 + 4, 6 + 6, 4 + 4 + 4, 3 + 3 + 3 + 3 |
Twelve is popular because it divides evenly by 2, 3, 4 and 6. One grid then supports halves, thirds, quarters and sixths. A prime count such as 5 or 7 divides poorly, so you can only build a few symmetric layouts from it. Use one only when the design is deliberately asymmetric.
More columns give more freedom and also more ways to make an inconsistent page. A designer using 12 columns should still limit the layout to a handful of recurring spans, such as 8 + 4, 6 + 6 and 4 + 4 + 4.
Let line length set the column
Column width should come from the text, not the other way round. In the previous chapter you saw that body text reads best at roughly 45 to 75 characters per line. Work backward from that range:
- Pick the body type size, for example 10 pt for print or 1 rem for screen.
- Estimate the width that gives about 60 characters at that size.
- Choose a column count so that a text span lands near that width.
For example, a 12-column web grid at 72 rem maximum width has columns of about 4.4 rem. Text spanning only 2 columns is about 9.8 rem, which holds only about 20 characters at body size. That is too narrow. A span of 6 columns, about 35 rem, is comfortable. You would not set body text across 2 columns on this grid. You would use those narrow spans for captions, labels or small images.
Narrow columns cause trouble in justified text. With only 20 to 30 characters per line, word spacing stretches unevenly and produces rivers, which are vertical gaps running through the text. Use left-aligned (ragged-right) text in narrow columns, or enable hyphenation if you must justify.
How gutters behave in a multi-column grid
Gutters exist only between columns, so a grid with N columns has N − 1 gutters. Margins are separate and sit outside the outer columns.
Three rules keep gutters working:
- Keep every gutter the same width. A varying gutter breaks the alignment that makes the grid useful.
- Make the gutter wide enough that two adjacent text columns do not run together. A gap of one to two times the body type size is a common starting point in print. Screen layouts often use 1 to 1.5 rem.
- Do not shrink the gutter to squeeze in another column. A narrower gutter lowers legibility more than a narrower column does.
When content spans several columns, it also covers the gutters between them. A span of s columns has width s × column + (s − 1) × gutter. For an A4 page with 20 mm margins, 5 mm gutters and 4 columns, each column is 38.75 mm wide. A two-column span is 2 × 38.75 + 5 = 82.5 mm. A four-column span is 4 × 38.75 + 3 × 5 = 170 mm, which equals the full live area, as it should. The next chapters cover the general calculation. For now, check that spans add up this way.
Equal and unequal columns
Most grids use equal columns, which makes every span predictable. Some designs use unequal columns, for instance a narrow marginal column for notes beside a wide text column. This is common in textbooks and annotated documents.
Unequal columns are really a grid with a small module and spans of different sizes. A 6-column grid can produce a narrow-and-wide layout by giving the notes 2 columns and the text 4. Compared with building the layout from hand-drawn columns, this has two advantages. Other elements can still align to the same lines, and the layout can change later without redoing the grid.
Seeing a span-based layout
The diagram below shows how three layouts reuse one 12-column grid.
Each layout uses the same column and gutter widths. Elements from different layouts could appear on one page and still line up.
Building it in CSS
CSS Grid expresses a multi-column grid directly. The following code defines 12 equal columns with a fixed gutter, centers the grid and places a main article and a sidebar.
.columns {
display: grid;
grid-template-columns: repeat(12, 1fr);
column-gap: 1.5rem;
max-width: 72rem;
margin-inline: auto;
}
.article { grid-column: 1 / span 8; }
.sidebar { grid-column: 9 / span 4; }Here repeat(12, 1fr) creates twelve equal columns, and column-gap is the gutter. grid-column: 1 / span 8 means "start at line 1, cover 8 columns". The sidebar starts at line 9 and covers 4. Grid lines are numbered from 1, so 12 columns have 13 lines. A span of 8 starting at line 1 ends at line 9, which is exactly where the sidebar begins, so the two blocks are separated by one gutter and nothing else.
The matching markup is short:
<div class="columns">
<main class="article">Main text</main>
<aside class="sidebar">Related links</aside>
</div>Use 1fr rather than percentages. Percentages do not account for gaps, so twelve columns of 8.33% plus eleven gaps would overflow. Fractional units distribute only the space left after the gaps are removed.
Text that flows across columns
Sometimes a single story must run through several columns, as in a newsletter. Print software links text frames so overflow moves from one column to the next. On the web, the CSS multi-column module does something similar:
.story {
column-count: 3;
column-gap: 1.5rem;
text-align: left;
hyphens: auto;
}This is different from CSS Grid. Grid places separate elements into tracks. The multi-column module flows one element's content through equal columns and balances their heights. Use grid to arrange the page, and use the multi-column module inside one block when text should flow. Avoid it for long text on screens, because readers have to scroll up and down repeatedly to follow the columns.
Common errors
- Starting with columns instead of text. Choosing 12 columns because a framework does, then discovering body text lands at 25 characters per line.
- Inconsistent gutters. Mixing 12 pt and 18 pt gaps between columns breaks edges that should align.
- Counting margins as gutters. Margins are outside the columns. Mixing them up gives a wrong column width.
- Too many different spans. If every block uses a unique span, the grid is present but invisible. Limit yourself to a few repeating spans.
- Narrow justified text. It produces rivers and uneven spacing.
- Forgetting that a span includes gutters. A two-column image is wider than twice a column.
Exercises
Exercise
An A4 landscape-width layout is 210 mm wide for this exercise. It has 15 mm margins on each side, 6 mm gutters and 3 columns. How wide is one column, and how wide is a block that spans two columns?
Show answer
Usable width is 210 − 2 × 15 = 180 mm. There are 2 gutters, so 180 − 12 = 168 mm is left for columns. One column is 168 / 3 = 56 mm. A two-column span is 2 × 56 + 6 = 118 mm, because it includes the one gutter between the columns.
Exercise
In the CSS example, the article uses grid-column: 1 / span 8 and the sidebar uses grid-column: 9 / span 4. Write the declaration that places a block across the middle six columns of the grid, leaving three columns empty on each side.
Show answer
grid-column: 4 / span 6; The block starts at line 4, after three columns, and covers six columns, ending at line 10. Columns 10 to 12 remain empty.
Exercise
A designer sets 11 pt body text in a 12-column print grid and places it in a two-column span that is about 30 mm wide. What problem will appear, and what are two ways to fix it?
Show answer
At 11 pt, a 30 mm line holds only about 15 to 18 characters, which is far below the 45 to 75 character guideline. Justified text would show large gaps and rivers. Fixes: place the text in a wider span, such as 5 or 6 columns, or reserve the narrow span for captions and labels set in a smaller size with left alignment. Reducing the column count so each column is wider also works.