UX Foundations · Step 6 · 6 min read
Layout, grids and spacing
A grid and a spacing scale turn hundreds of small layout choices into a few rules. Columns, gutters and margins, a spacing scale built on 4 and 8, how layouts adapt to phones, tablets and desktops, and what WCAG's reflow rule means for your designs.
A layout is a set of decisions about space. Where does content start? How wide can it get? How far apart are two fields, two cards, two sections? Make every one of those choices by eye and you'll get a screen that feels slightly off, and a product where no two screens match. A grid and a spacing scale replace hundreds of small guesses with a few rules everyone can follow.
What you'll be able to do after reading:
- Name the parts of a layout grid: columns, gutters and margins
- Use a spacing scale built on multiples of 4 or 8
- Use space to show grouping and hierarchy
- Plan how a layout changes between phone, tablet and desktop
1. The parts of a grid
Vertical strips where content sits.
4 on phones, 8 on tablets, 12 on desktopsThe fixed space between columns.
Wider on bigger screensThe space between content and the screen edge.
Keeps text off the bezelA short list of allowed spaces.
Multiples of 4 or 8Material Design describes a responsive layout grid as "made up of three elements: columns, gutters, and margins" (Material Design 2, Responsive layout grid):
- Columns hold the content. Their width is a percentage, so they stretch with the screen.
- Gutters are "the spaces between columns". Material uses 16 dp on a 360 dp phone and 24 dp on a 600 dp tablet.
- Margins are "the space between content and the left and right edges of the screen", 16 dp on phones in Material's example.
The same page notes that Material "provides responsive layouts based on 4-column, 8-column, and 12-column grids": 4 on phones, 8 on small tablets, 12 on larger screens. Many web frameworks also use 12 columns, because 12 divides evenly into halves, thirds, quarters and sixths.
(dp means density-independent pixel: a unit that looks the same physical size on screens of different density. On the web, think CSS px.)
2. A spacing scale
A spacing scale is a short list of allowed spaces. Instead of 13 px here and 17 px there, you choose from, say, 4, 8, 12, 16, 24, 32, 48, 64.
Material Design 2 aligned components "to an 8dp square baseline grid", while "Icons, type, and some elements within components can align to a 4dp grid" (Material Design 2, Spacing methods). Material Design 3 keeps the same base: "The spacing system is measured on an 8dp scale, where space100 = 8dp", with smaller steps such as 2, 4 and 6 for fine details (Material Design 3, Spacing).
Why 4 and 8? They divide easily, they work on common screen sizes and densities, and a team can remember them. The exact base matters less than everyone using the same one.
- 4Hairline
Icon to its label.
- 8Tight
Label to its field; lines in a list item.
- 16Normal
Between fields; padding inside a card.
- 24Loose
Between groups of fields.
- 32+Section
Between sections of a page.
3. Space shows structure
Spacing isn't only tidiness; it tells people what belongs together. This is proximity from Gestalt principles made into a rule: small spaces inside a group, bigger spaces between groups.
Worked example: a delivery address card.
| Space | Value | Why |
|---|---|---|
| Icon to its label | 4 | They're one unit |
| Label to its field | 8 | Clearly one pair |
| Field to the next field | 16 | Separate, same group |
| Address group to payment group | 32 | A new topic |
| Card padding (inside edge) | 16 | Content doesn't touch the border |
Squint at the result (Visual hierarchy): you should see two blocks, not a column of evenly spaced boxes.
4. Responsive layout basics
The same content has to work from a small phone to a wide monitor. Instead of designing for every device, teams design for a few breakpoints, the widths where the layout changes. Android's guidance, based on Material, uses window size classes such as compact (under 600 dp, almost all phones in portrait), medium (600 to 839 dp, most tablets in portrait) and expanded (840 to 1,199 dp), with large and extra-large classes above that for big tablets and desktops (Android Developers, Use window size classes).
What usually changes at a breakpoint:
- Number of columns: one column of cards on a phone, two or three on a tablet.
- Navigation: a bottom bar on phones, a side rail or drawer on wider screens (see Navigation patterns).
- Margins and gutters: wider on bigger screens.
- Text width: capped, so lines don't get too long (Typography for interfaces).
WCAG adds a floor. Success criterion 1.4.10 Reflow (level AA) asks that content works "without requiring scrolling in two dimensions" at a width "equivalent to 320 CSS pixels" (WCAG 2.2). W3C notes this equals a 1,280 px wide screen zoomed to 400%. So a desktop layout must reflow into one column when someone zooms in, not force them to scroll sideways to read each line.
5. Touch targets need space too
Spacing also protects fingers. Material recommends touch targets of "at least 48 x 48 dp with at least 8dp of space between targets" (Material Design 2, Spacing methods). Small icons can stay small; their tappable area grows with padding. This is Fitts's law from How people think, in pixels.
6. Common mistakes
- Spacing chosen by eye on every screen: 13, 15, 17, 22 px.
- The same space everywhere, so no groups are visible.
- Desktop layouts squeezed onto phones instead of reflowing.
- Content stretched across very wide screens.
- Tap targets packed together with no space between them.
7. Vocabulary
| Term | Meaning |
|---|---|
| Layout grid | Columns, gutters and margins that content aligns to |
| Column | A vertical strip that holds content |
| Gutter | The space between columns |
| Margin | The space between content and the screen edge |
| Spacing scale | A short list of allowed spaces, often multiples of 4 or 8 |
| Breakpoint | A screen width where the layout changes |
| Reflow | Content rearranging to fit a narrow width without sideways scrolling |
| dp | Density-independent pixel, a unit that keeps sizes consistent across screens |
8. Try it (no tools needed)
- Draw a phone screen on paper with a 4-column grid: 16 margin on each side, 16 gutters.
- Lay out a simple product page on it: image, title, price, a button and three details.
- Now draw the same page for a wide screen with 12 columns. Decide what moves, what grows and what stays capped.
Reflection questions: Which spaces did you have to decide by eye? Could each one be a step on a 4 or 8 scale? What should never get wider, even on a big screen?
9. If you already practise
- Turn your spacing scale into tokens ("space-100", "space-200") so design and code use the same names; see Design tokens.
- Test real layouts at 320 px width and at 400% zoom, not only at your design width.
- Use auto layout or CSS gap with scale values, so spacing is set once per component instead of nudged by hand.
Checklist
Learn more
- Material Design 2: Responsive layout grid · Spacing methods
- Material Design 3: Spacing
- Android Developers: Use window size classes
- W3C: Understanding SC 1.4.10 Reflow (WCAG 2.2)
Books, courses and videos to go deeper
- Grid Systems in Graphic DesignJosef Müller-BrockmannBook · Niggli, 1981 · the classic on grids from print (Amazon)
- Refactoring UIAdam Wathan and Steve SchogerBook · 2018 · with clear chapters on spacing (external site)
Book links go to Amazon. As an Amazon Associate I earn from qualifying purchases, at no extra cost to you.
Related
Gestalt principles · Visual hierarchy · Navigation patterns · What a design system is · Design tokens