Principle 12
Every margin, padding and gap is a step of the same scale. A screen built from a handful of values looks deliberate; one with 13px here and 17px there looks like a mistake, even when nobody can say why.
In a real interface
✕ Avoid
✓ Do
01
Refactoring UI dedicates a chapter to establishing a spacing and sizing system, so each decision is a choice among a few values instead of a new guess.
Atlassian builds its whole system on an 8 pixel base unit, with a limited set of values from 0 to 80px, and asks for its tokens instead of raw pixel values so spacing stays consistent across apps.
02
Pick a base, usually 4 or 8, and a short scale that grows faster as it goes up: 4, 8, 12, 16, 24, 32, 48, 64. Name the steps as tokens and use only those in code.
Choose by relationship, not by eye: the smallest steps inside a component, larger ones between components, the largest between sections. NN/g treats this kind of consistency as a core usability heuristic.
03
Optical corrections are allowed, such as nudging an icon so it looks centered, but they stay local and documented. Borders add their width to the box, so a 1px border can be absorbed in the padding to keep the outside on the scale.
✓ Do
✕ Avoid
For agents · PRINCIPLE.md
## Spacing comes from one scale
- Pick a base of 4 or 8 and a short scale: 4, 8, 12, 16, 24, 32, 48, 64.
- Use spacing tokens in code, never raw pixel values.
- Small steps inside a component, larger between components, largest between sections.
- Document any optical exception where it is used.
Enforced bykero-audit spacing values off the scalekero-system writes the spacing scale into the project skill