Sub topic 2
Proximity: group related items
Proximity is the principle that related items should sit close together and unrelated items should sit apart. The reader sees distance as meaning. Items that are near each other look like one group, and items that are far apart look like separate groups. This chapter assumes you know basic typography terms (typeface, size, weight, line spacing) and common layout elements such as headings, body text, images, and buttons. You should also have used a layout tool such as Figma, Canva, Illustrator, InDesign, or plain CSS.
What proximity does
A layout usually holds more than one idea. Proximity tells the reader where one idea ends and the next begins, before they read a single word. This ties directly to visual hierarchy: if the groups are clear, the eye can move from group to group instead of scanning every item one at a time.
Proximity does three jobs:
- It groups items that belong together, such as a heading and its paragraph.
- It separates items that do not belong together, such as two unrelated cards.
- It sets reading order, because the eye tends to finish one group before moving to the next.
The principle is about relative distance, not absolute distance. A 16px gap is tight in one layout and loose in another. What matters is that gaps inside a group are clearly smaller than gaps between groups.
A worked example: a event card
Consider a card with a label, a title, a date, a description, and a button. A common first draft spaces everything evenly, say 16px between each item. The result reads as a column of five unrelated things.
Ask which items belong together:
- The label and title describe what the event is.
- The date and description give details about it.
- The button is an action, separate from the information.
Now apply spacing that matches those relationships:
| Relationship | Gap |
|---|---|
| Label to title | 4px |
| Title to date | 8px |
| Date to description | 8px |
| Description to button | 24px |
The button is now set apart from the information, and the label hugs the title. Nobody has to be told what goes with what.
Proximity in code
Here is the same idea as a CSS card. The gap inside the card is small, and the margin between cards is larger. The heading also differs from the body in size and weight, which is contrast working alongside proximity.
.card {
display: grid;
gap: 8px;
padding: 24px;
max-width: 40ch;
}
.card h2 {
margin: 0;
font-size: 1.5rem;
font-weight: 700;
}
.card p {
margin: 0;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
}
.card + .card {
margin-top: 32px;
}Items inside a card sit 8px apart. Cards sit 32px apart. The ratio between the two gaps is 4 to 1, and that ratio is what makes each card read as one unit. The margin: 0 rules matter: browsers give headings and paragraphs default margins, and those defaults would add uneven gaps that fight your gap value. Setting them to zero lets one rule control spacing.
Using white space to separate and group
White space is the empty area around and between elements. It is the main tool for proximity, but it is not the only one. You can also group items with a shared background, a border, or a divider line. Each tool has a cost.
| Tool | Strength | Cost |
|---|---|---|
| Spacing alone | Light, clean, adds no extra marks | Needs a clear difference between gap sizes |
| Background tint | Strong grouping, works in dense layouts | Adds a color that must be managed |
| Border or box | Very explicit | Adds visual weight, can look heavy when overused |
| Divider line | Good for lists and tables | Adds clutter if every item gets one |
Try spacing first. Add a stronger tool only when spacing alone cannot do the job, for example in a dense dashboard where gaps between groups must stay small.
A scale for spacing
Picking gaps at random leads to near-misses, such as 14px in one place and 16px in another. Readers cannot tell that difference apart, but it still looks slightly off. A small scale avoids this. Many teams use steps based on 4px or 8px: 4, 8, 16, 24, 32, 48. Choose from the scale, and the groups will have clear, repeatable differences.
A useful rule of thumb: make the outer gap at least about twice the inner gap. If the difference is smaller, readers may not perceive two levels.
Spacing the text itself
Proximity also applies to type. Line spacing, paragraph spacing, and heading spacing all signal grouping:
- Lines in one paragraph are close together.
- Paragraphs are separated by a larger gap.
- A heading sits closer to the paragraph it introduces than to the paragraph above it.
That last point is one of the most common fixes in real layouts. A heading with equal space above and below floats between two paragraphs, and the reader cannot tell which one it introduces. Put more space above the heading than below it.
h2 {
margin-top: 2rem;
margin-bottom: 0.5rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}In this example the heading has 2rem above and 0.5rem below, so it attaches to the paragraph that follows.
Proximity and other principles
Proximity rarely works alone. Here is how it connects to the other three principles in this tutorial.
- Alignment. Items in a group usually share an edge as well as a small gap. Proximity says these belong together. Alignment confirms it. A later chapter covers alignment in detail.
- Repetition. If every card uses the same inner and outer gaps, the reader learns the pattern once and reads every card the same way.
- Contrast. Contrast of size and weight sets the order within a group. Proximity sets the group boundaries.
Edge cases and common errors
Equal spacing everywhere
This is the most frequent error. Every item has the same gap, so no groups form. The fix is to decide the groups first, then shrink the inner gaps and enlarge the outer ones.
Spacing that contradicts the content
A caption sits closer to the wrong image, or a button label sits nearer to the next form field than to its own field. The reader will pair items by distance, even when the content says otherwise. Check every caption, label, and button: which item is it closest to?
Too many groups
If a page has twelve small groups, the eye has twelve places to stop. Merge groups where you can. Aim for a few clear clusters, then use secondary cues such as heading style inside each.
Groups that are only slightly apart
If the inner gap is 12px and the outer gap is 16px, the difference is too small to read. Increase the outer gap, decrease the inner gap, or both, until the two levels are obvious at a glance.
Squinting test
Blur your view of the layout, for instance by squinting or by applying a blur filter in your design tool. The clear groups should still be visible as separate blobs. If they merge into one mass, the proximity is not strong enough.
Orphaned items
An item that sits between two groups and belongs to neither confuses the reader. Common examples are a stray date, a lone icon, or a floating "Read more" link. Move it into one group, and make the gap to the other group clearly larger.
A quick procedure
Use this when you build or review a layout:
- List every element on the page.
- Write down which elements belong together and why.
- Set the inner gap for each group from your spacing scale.
- Set the outer gap at least twice as large.
- Check ambiguous items such as captions, labels, and buttons for their nearest neighbor.
- Apply the squint test.
Exercise
A form has a label, an input, and a helper text line for each of three fields. Every gap in the form is 16px, including the gap between one field's helper text and the next field's label. Why is this a proximity problem, and what spacing would you change it to?
Show answer
Equal gaps make the label, input, and helper text look as if they belong as much to the next field as to their own. Reduce the gaps inside each field to about 4px to 8px (label to input, input to helper text), and increase the gap between fields to about 24px to 32px. The outer gap is then at least twice the inner gap, so each field reads as one group.
Exercise
A blog post has a heading with 1.5rem of margin above and below it. Readers sometimes think the heading belongs to the paragraph above. What change fixes this, and which principle does it apply?
Show answer
Increase the space above the heading (for example 2rem) and decrease the space below it (for example 0.5rem). The heading then sits closer to the paragraph it introduces. This applies proximity: nearer items are read as related.