Sub topic 9
Placing text and images across columns and modules
This chapter assumes you know the parts of a grid, how to calculate column widths from margins and gutters, and how a modular grid divides a page into rows and columns. It also assumes basic CSS.
Spanning is the basic move
A grid gives you slots. A block of content is placed by choosing how many columns or modules it spans. Its edges sit on grid lines, so every block aligns with its neighbours.
A block that spans several columns also covers the gutters between them. Its width is:
span width = n × column width + (n − 1) × gutterThe following function builds on the column calculation from the grid math chapter.
def span_width(column, gutter, n):
"""Width of a block that spans n columns."""
return n * column + (n - 1) * gutter
column = 38.75 # mm, from the A4 example: 20 mm margins, 5 mm gutters, 4 columns
for n in range(1, 5):
print(n, span_width(column, 5, n))
# 1 38.75
# 2 82.5
# 3 126.25
# 4 170.0Spanning all four columns gives 170 mm, which is the usable width (210 − 2 × 20). That match confirms the arithmetic.
Choosing spans for text
Text spans are limited by line length. On the four-column page above, one column is too narrow for body text at normal sizes, and four columns is too wide. A two-column span of 82.5 mm fits a comfortable measure at 9 to 10 pt. Headlines and pull quotes can span more columns because they are large and short.
Choose the span from the type size first, then check that it lands on grid lines.
Choosing spans for images
Images are more flexible, but each size should be a whole number of modules.
| Image role | Typical span | Effect |
|---|---|---|
| Inline illustration | 1 module | Quiet, supports the text |
| Standard figure | 2 columns × 2 rows | Matches the text width |
| Feature image | Half the page or more | Sets the focal point |
| Full-width banner | All columns | Divides the page |
Crop the image to the shape of its module span. A 2-column by 3-row block has a fixed shape, so scale the image to fill it and crop the overflow. Do not stretch it.
A modular placement in CSS
This example reuses the modular grid from the previous chapter. The feature image spans two columns and three rows. The caption sits beside it, on the same grid lines.
.modular {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(6, 8rem);
gap: 1rem;
}
.feature { grid-column: 1 / span 2; grid-row: 1 / span 3; }
.caption { grid-column: 3 / span 2; grid-row: 1; }
.feature img {
width: 100%;
height: 100%;
object-fit: cover;
}The feature block is 3 × 8rem + 2 × 1rem = 26rem tall. The row gaps inside the span count toward its height, in the same way gutters count toward its width. The object-fit: cover rule crops the image to the block instead of distorting it.
Common errors
- Forgetting the gutters. Calculating a two-column span as 2 × column width leaves it too narrow, so it falls short of the grid line.
- Spanning too wide for the type. A text block across six columns of a 12-column grid can reach 120 characters per line. Reduce the span or increase the type size.
- Captions that ignore the grid. A caption should share a left edge with its image or sit on the next grid line.
- Images that end mid-module. Half-module heights break the vertical alignment of the whole page. Crop to full modules.
Exercise
A 12-column web grid has a column width of 60 px and a gutter of 20 px. How wide is an image that spans 5 columns, and why is it not 300 px?
Show answer
It is 5 × 60 + 4 × 20 = 380 px. The span includes the four gutters between its five columns, so 300 px would stop short of the right grid line by 80 px.