Sub topic 2
Place Sections on a Grid with a Spacing Scale
Assume you know basic HTML and CSS, and can create frames and components in a design tool. At this stage, the low-fidelity wireframe already defines the section order. Your job is to make its geometry consistent without adding visual decoration too early.
Use a layout grid
A grid gives sections shared alignment rules. Start with a centered content container, a maximum width, and equal columns. Keep full-width backgrounds separate from the inner content grid.
For example, a desktop page might use 12 columns with a 24-pixel gap. A feature card can span four columns, while the hero content can span eight.
Use fewer columns on small screens. The important rule is consistency: headings, text blocks, cards, and buttons should align to predictable edges.
Establish a spacing scale
A spacing scale limits arbitrary values. Choose a base unit, such as 8 pixels, then create larger steps for related purposes.
| Token | Value | Typical use |
|---|---|---|
| `space-1` | 0.5rem | Icon and label gap |
| `space-2` | 1rem | Text block gap |
| `space-4` | 2.5rem | Section padding |
Keep spacing within a section smaller than spacing between sections. This creates grouping and improves scanning.
Set a type scale and heading rhythm
Choose heading sizes as a system rather than styling each heading independently. Each page section should normally have one h2, followed by supporting text or lower-level headings. Use line height generously for body text, and keep paragraph measure near 45–75 characters.
Pick a color palette and imagery
Assign colors by role: background, text, muted text, border, and accent. Reserve the accent for important actions and links. Select imagery that supports the page goal, then define its crop and aspect ratio so the layout remains stable.
Capture decisions as tokens and components
Store repeated values as design tokens. Components should consume those tokens, so one change updates every instance.
:root {
--space-1: 0.5rem;
--space-2: 1rem;
--space-4: 2.5rem;
--color-text: #1a1a1a;
--color-accent: #0b5fff;
--font-body: 1rem;
--font-h1: 2.5rem;
}
.hero {
padding: var(--space-4) var(--space-2);
color: var(--color-text);
}
.hero a {
color: var(--color-accent);
font-size: var(--font-body);
}Exercise
A feature card uses 40px of internal padding, but your scale contains only 8px, 16px, 32px, and 48px. Which value should you choose first?
Show answer
Choose 32px or 48px based on the card’s visual grouping, then record the decision as a token if it recurs. Avoid adding 40px only to match one instance.