A grid gives every page the same rhythm, so cards, forms and tables line up and screens feel like one product.
Lay out the main content area on 4 columns on phones, 8 on tablets and 12 from 1024 px.
Columns, gutters and margins
| Window | Columns | Gutter | Page margin |
|---|---|---|---|
| Below 768 px | 4 | 16 px | 16 px |
| 768 to 1023 px | 8 | 24 px | 24 px |
| 1024 to 1439 px | 12 | 24 px | 24 px |
| 1440 px and up | 12 | 24 px | 32 px |
The values are spacing tokens: 16 px is space.200, 24 px is space.300 and 32 px is space.400. The ranges start at the md, lg and xl breakpoints. The column counts are layout.grid.columns.small, .medium and .large.
- 12 columns divide into halves, thirds, quarters and sixths.
- 4 columns on phones give two halves or four quarters. 8 on tablets keep the same halves and quarters with more room.
- Gutters are 16 px on phones and 24 px from 768 px, where there is room to separate cards more clearly.
- Page margins start at 16 px and grow to 32 px on wide screens, so content does not touch the edge of a large window.
- Every value is a spacing token and a multiple of 8 px. Text line heights sit on the same 4 px grid, so cards, text and controls line up.
Use the same gutter between rows, so cards are as far apart down as across.
Fluid columns
Columns stretch with the window. Gutters and margins stay fixed within each range.
A wider window gives wider columns, not more empty space. At the next breakpoint the gutter, the margin or the number of columns changes.
Where the grid sits
The grid spans the main content area only.
- The header and the side navigation are not on the grid. The grid starts where the side navigation ends, so its columns always divide the content area.
- The side navigation keeps a fixed width instead of taking columns. As columns, it would grow and shrink with the window, and collapsing it to the rail would break the column count.
- Breakpoints still read the window width. Opening or collapsing the side navigation does not change the breakpoint.
- Content inside a panel or a card can follow the width of its container instead, with container queries.
- On a wide or narrow page, the grid fills the capped width. See Page widths.
Spans
A span is the number of columns an item covers.
| Layout | Below 768 px (of 4) | 768 px (of 8) | 1024 px (of 12) | 1440 px (of 12) |
|---|---|---|---|---|
| Cards, 1 to 4 a row | 4 | 4 | 4 | 3 |
| Main panel and side panel | 4 | 8 | 8 + 4 | 9 + 3 |
| Summary tiles | 2 | 2 | 3 | 2 |
In CSS, the grid is a few lines:
.page-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: var(--bh-space-200);
padding-inline: var(--bh-space-200);
}
@media (min-width: 768px) {
.page-grid {
grid-template-columns: repeat(8, minmax(0, 1fr));
gap: var(--bh-space-300);
padding-inline: var(--bh-space-300);
}
}
@media (min-width: 1024px) {
.page-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}
@media (min-width: 1440px) {
.page-grid { padding-inline: var(--bh-space-400); }
}
What goes on the grid
- Page regions align to columns: cards, panels, form columns, tiles.
- Controls inside a region do not. Inside a card, use spacing tokens.
- A data table fills its region. Do not split table columns along the grid.
See Breakpoints for when the grid changes.