New: Cookbooks and AI ExplanationsStep-by-Step recipes to solve problems connected to Roadmaps and Cheat Sheets. Need more details? Use AI buttons for structured and simple explanations with concrete examples throughout the whole platform.Take a look
Two stacked boxes have a bigger gap between them than either margin alone should produce, and I can't tell where the extra space came from.
What you'll have at the end
A layout where the vertical spacing between elements matches the numbers you actually wrote, with no mystery extra gap
You need
Two stacked block elements on a page whose CSS margins you can edit, and a browser you can inspect the rendered layout in.
Not covered
Negative margins and the floated or absolutely positioned elements that never collapse at all; this covers only plain stacked block boxes.
Leans on
Checked 20 Aug 2026
Part of the CSS cookbook