UI Design · Lesson 04 / 12
Layout & grids
Alignment, column grids, the 8-point spacing system, whitespace, layout patterns and content width — everything you need to create calm, organised and responsive layouts.
4 min read · 5 quiz questions
Why layout matters
Layout is how elements are arranged on a screen. A good layout feels calm and obvious: you know where to look, related things sit together, and edges line up. A poor layout feels busy and "off" even when people can't say why — usually because of inconsistent alignment and spacing.
Three tools do most of the work: alignment, grids and spacing.
Alignment
Every element should align with something else. Shared edges create invisible lines that the eye follows and that make a layout feel ordered.
- Edge alignment — text, images and buttons share a left (or right, in RTL) edge.
- Centre alignment — works for short, symmetric content like hero headings or empty states. Avoid it for long text.
- Baseline alignment — text of different sizes in one row sits on the same baseline.
- Optical alignment — sometimes elements must be nudged to look aligned, like a play icon inside a circle or a round shape next to a square one.
Common mistake: "Almost aligned" elements — 2–3 pixels apart. They look like mistakes. Either align exactly or make the difference clearly intentional.
Column grids
A column grid divides the screen into vertical columns separated by gutters. Content spans one or more columns. Grids make layouts consistent across screens and make responsive design predictable.
Common setups
- Mobile: 4 columns, 16px margins, 16px gutters.
- Tablet: 8 columns, 24–32px margins, 16–24px gutters.
- Desktop: 12 columns, 24–80px margins, 24–32px gutters, max width around 1200–1440px.
Why 12 columns?
12 divides evenly into 2, 3, 4 and 6, so you can create halves, thirds, quarters and sixths without breaking the grid.
| Part | Description |
|---|---|
| Columns | The vertical areas where content sits |
| Gutters | The space between columns |
| Margins | The space between the outer columns and the screen edge |
| Max width | The largest the content area grows on wide screens |
The grid is a guide, not a cage. Full-bleed images, background colours and some hero sections can break out of it — on purpose.
The 8-point spacing system
Instead of choosing spacing values by eye (13px here, 17px there), most teams use a spacing scale based on multiples of 8 (with 4 for small adjustments): 4, 8, 12, 16, 24, 32, 40, 48, 64, 80, 96…
- Consistency — the same few values repeat, so layouts feel coherent.
- Speed — fewer decisions; designers and developers use the same values.
- Scaling — 8 divides cleanly on common screen densities (1×, 2×, 3×).
- Element heights also follow the scale: buttons 40 or 48px, inputs 40 or 48px, icons 16/20/24px.
Live preview
:root {
--space-1: 4px; --space-2: 8px; --space-3: 12px;
--space-4: 16px; --space-6: 24px; --space-8: 32px;
--space-12: 48px; --space-16: 64px;
}
.card { padding: var(--space-6); }
.card + .card { margin-top: var(--space-4); }Whitespace and grouping
Whitespace (or negative space) is the empty space between and around elements. It isn't wasted — it groups related items, separates unrelated ones, improves readability and gives important elements room to stand out.
- Micro whitespace — between lines, letters, list items, an icon and its label.
- Macro whitespace — between sections, around the main content, page margins.
A reliable rule: internal spacing ≤ external spacing. The space inside a group (between a card's title and text) should be smaller than the space between groups (between two cards). Otherwise, groups visually fall apart.
Content width and readability
- Long lines are tiring to read. Keep body text around 45–75 characters per line (roughly 600–720px at 16px).
- On wide screens, centre the content with a max width, or use a multi-column layout.
- Forms are easiest to complete in a single column with a comfortable width (usually under ~600px).
Common layout patterns
| Pattern | Use for |
|---|---|
| Single column | Articles, forms, mobile screens, focused tasks |
| Sidebar + content | Dashboards, documentation, settings, admin tools |
| Card grid | Products, projects, galleries, search results |
| Split screen | Sign-up pages, comparisons, image + text heroes |
| List–detail | Email, messages, file managers |
| Holy grail | Header, footer, main content with side columns |
Layout in code
Modern CSS makes grids and alignment straightforward. Designers who understand these basics hand off layouts that are easier to build:
/* 12-column grid that collapses on mobile */
.grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 16px;
max-width: 1280px;
margin-inline: auto;
padding-inline: 16px;
}
@media (min-width: 1024px) {
.grid { grid-template-columns: repeat(12, 1fr); gap: 24px; }
.main { grid-column: span 8; }
.aside { grid-column: span 4; }
}Figma's auto layout works like CSS flexbox, and layout grids map to CSS grid. Designing with them makes handoff much smoother.
Key takeaways
- Alignment, grids and spacing do most of the work in a calm layout.
- Every element should align with something; avoid 'almost aligned'.
- A 12-column desktop grid (4 on mobile) divides into halves, thirds and quarters.
- An 8-point spacing scale gives consistency; internal spacing should be ≤ external spacing.
- Keep text lines to 45–75 characters and use a max content width.
Exercise
Rebuild a page on a grid
- Screenshot a cluttered web page.
- In Figma, add a 12-column layout grid (1280px wide, 24px gutters).
- Rebuild the page's main sections on the grid using only 8-point spacing values.
- Check that spacing inside groups is smaller than spacing between groups.
- Create the mobile version on a 4-column grid.
Test yourself
Layout & grids quiz
5 questions. Score 70% or more to complete the lesson.
