When a website looks “clean” and you can’t say why, its spacing often follows a rule. Jurors see it straight away, and they see the opposite too: margins that are all slightly different.
A base unit
Pick a unit, 4 or 8 pixels, and build a scale from it: 8, 16, 24, 32, 48, 64, 96. Every margin and gap on the site comes from that scale. You no longer decide each time, and the whole thing feels consistent.
A grid to align to
- 12 columns on large screens, 4 on phones, with regular gutters.
- One maximum content width, the same on every page.
- Text and image edges that land on the same lines.
- More space between two sections than between a heading and its text: space shows what belongs together.
In CSS
Store the scale in variables (--space-1, --space-2…), use CSS Grid for layout and clamp() for sizes that adapt to the screen without sudden jumps. One container, with side margins of at least 16 px on phones.
The final test
Open the site at 375 px wide: nothing should overflow or cause horizontal scrolling. Then squint or step back from the screen: the blocks should form clear groups.