The 8-point spacing system for cleaner layouts
Random spacing is one of the quickest ways to make a design feel unfinished. A spacing system fixes this by limiting your choices to a short list.
How it works
Use multiples of 8 for margins, padding and gaps: 8, 16, 24, 32, 48, 64 and 96. Add 4 for tight spots, such as the gap between an icon and its label. Instead of debating 13 or 15 pixels, you choose between 12 and 16.
Why 8?
Eight divides evenly into 4 and 2, which helps when designs scale across screen densities. The steps are also large enough to look different from each other. If your product needs a tighter feel, a 4-point scale works in the same way.
Use space to show relationships
Things that belong together should sit closer than things that do not. A label sits 4 or 8 pixels from its input, while separate form groups sit 24 pixels apart. Readers then understand the structure with no extra lines or boxes.
Put it into code
Define the scale once as CSS variables, such as --space-2: 16px. Then use those names everywhere. A later change happens in one place, and nobody has to guess.
Know when to bend it
Optical adjustments are fine. An icon inside a button may need a pixel or two of nudging to look centered. Treat these as exceptions, and keep the overall system.
Keep reading
- How to pair fonts for a website
A simple approach to choosing one or two typefaces that work well together.
- How to choose font sizes with a type scale
Use a simple ratio to set consistent headline and body sizes across a website.
- Line height and line length: small settings that make text readable
The ranges to aim for, and why long lines and tight spacing make people stop reading.