Module 2 ยท Layout, hierarchy and type Lesson 4 of 15
Spacing and the 8-point grid
Spacing in consistent steps โ 4, 8, 16, 24, 32 โ is what makes an interface feel deliberate. Arbitrary numbers are what make it feel accidental.
The concept
Spacing is what makes a layout look deliberate, and the easiest rule that works is the 8-point grid: every margin, padding and gap is 8, 16, 24, 32 โ multiples of eight. Pick the scale once, use only those numbers, and unrelated elements start to look related.
Grouping does more than size: elements that belong together sit closer to each other than to their neighbours. A label should be 4px from its input and 24px from the next field, so the eye reads the pairs without being told. Whitespace is not wasted space; it is how the page says what goes with what.
:root {
--s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s6: 48px;
}
.field { margin-bottom: var(--s1); } /* label 8px from its input */
.field + .field { margin-top: var(--s3); } /* 24px to the next field */
.card { padding: var(--s3); display: grid; gap: var(--s2); }
/* Only use these numbers. Never hand-tune a pixel. */Common mistakes
The mistake is nudging things until they look right at one window size. Fixed multiples of eight survive a resize and a new screen; hand-tuned pixel values do not, and the layout drifts apart the moment somebody adds a line of text.
Worked example
Padding of 13px above and 17px below looks like a mistake at a glance; 12 and 16 looks intentional, and the change costs nothing.
Your practice task
Redo one screen of your own using only spacing values from that grid and compare it side by side with the original.
Do this before moving on. Reading a solution teaches the shape of it; typing it teaches you.
Key takeaway
Spacing is what makes a layout look deliberate, and the easiest rule that works is the 8-point grid: every margin, padding and gap is 8, 16, 24, 32 โ multiples of eight.
Keep your place in this course
A free account saves which lessons you have finished and unlocks the certificate. The lesson itself stays free to read.
Create free account or sign inCourse complete
You finished every lesson.
Your certificate is ready, and the projects you built are the proof to attach to an application.
Almost there
15 lessons left of 15
Finish every lesson to unlock the certificate. Each one ends in a practice task โ do them and the final project brief writes itself.