Part 3 of 6 · Chapter 4 of 5

Every Element Is a Box With Four Layers

Set an element to 300 pixels wide, add padding, and measure it: it is 340. That one behaviour has confused every person who has ever learned CSS, and one line of code fixes it permanently.

Intermediate12 min read

Worth reading first: Three Ways In, One You Should Use


Make a free account to read on

Every chapter is free — an account is how your progress, XP, and streak follow you from your laptop to your phone, and how you show up on the leaderboard. No payment, no trial.