Every element on a page is a rectangular box made of four layers, from the inside out: content, padding, border, and margin. Confusion about how those four layers add up together is behind an enormous share of "why is this 20px too wide" bugs.
content-box vs border-box
By default, width sets only the content layer - padding and border get added on top of it, which is rarely what anyone actually wants:
* { box-sizing: border-box; }
/* now width includes padding and border, not just content */
That one reset, applied globally, is close to a permanent fix for the "my box is wider than I set it to be" class of bug.
Margin collapsing catches everyone once
Vertical margins between adjacent block elements collapse into the larger of the two rather than adding together. It looks like a bug the first time you see it; it's specified behaviour, and knowing it exists saves a confusing afternoon.
A worked example, because the numbers rarely lie twice
.box {
width: 300px;
padding: 20px;
border: 5px solid;
}
/* content-box (default): rendered width = 300 + 40 + 10 = 350px */
/* border-box: rendered width = 300px, content shrinks to fit */
That 50px gap between what you set and what you get is the single most common source of "why doesn't this line up with the column next to it" layout bugs - and it's entirely explained by which box-sizing mode is active.
Inline vs block boxes still trip people up
Padding and margin apply differently depending on display type: a span (inline) will happily ignore top/bottom margin and can look inconsistent with padding depending on line-height, while a div (block) respects the full box model as expected. When a spacing rule "isn't working," checking the element's computed display type is often the faster diagnosis than second-guessing the CSS value itself.