The other box-model surprise worth knowing well: when two vertical margins meet, they don't add together — the larger one wins.
.first { margin-bottom: 30px; }
.second { margin-top: 20px; }
/* the gap between .first and .second is 30px, not 50px */
A few rules about exactly when this happens:
<div> wrapping a <h1> with margin-top can appear to "push the wrapper down" instead of adding space inside it.overflow: hidden, display: flow-root, or absolutely positioned elements) — one more reason those layout modes feel more predictable than plain block flow.The practical fallout: don't assume stacking two elements with margin: 20px each gives you 40px of gap between them — measure, or reach for Flexbox/Grid with gap (covered later), which never collapses and is far easier to reason about.