Law of proximity

Things placed close together read as one group. Spacing, not boxes or lines, is what tells people which items belong with which.

put related things closergroup it by spacinggestalt proximityproximity principlethings close together look relatedspacing tells you what belongs togetherlaw of proximetythe label should hug its input

See it

Live demo coming soon

What it is

One of the Gestalt grouping principles catalogued by Max Wertheimer in the 1920s: objects near each other are perceived as one group, whatever they actually are. In interface terms, distance is one of your strongest grouping signals, and on a plain page it usually beats colour, borders, and background panels. It is not unbeatable: a shared container or a connecting line can pull two far-apart items into one group. But a form label three pixels from the wrong field belongs to the wrong field, and no styling will argue people out of it.

The working rule is that space outside a group must beat space inside it, usually by roughly double. Label 8px above its input, 32px between fields. Caption 8px under its image, 48px before the next section. Heading closer to the paragraph it introduces than to the paragraph above it. Get that ratio right and most layouts stop needing dividing lines at all.

Gotcha: when a screen feels confusing, the instinct is to add cards, borders, and background tints. That is usually a patch over uniform spacing. Fix the gaps first and the boxes become unnecessary. Second gotcha: proximity outranks the heading. A section title with equal space above and below floats between two sections and gets attached to the wrong one, which is the single most common spacing bug in long pages.

Ask AI for it

Re-space this layout using the Gestalt law of proximity so grouping comes from whitespace instead of borders. Make the space between groups at least twice the space inside a group: 8px between a label and its input, 32px between form fields, 16px between a heading and its body copy, 64px between page sections. Bind every heading and caption to the content it describes by giving it more space on the far side than the near side. Then delete any card borders, dividers, or background tints that were only there to show grouping. Use a 4px spacing scale and no arbitrary values.

You might have meant

whitespace negative spacespacing scalevisual hierarchyalignmentvertical rhythm

Go deeper