Margin collapsing

noun

say it: “MAR-jin kuh-LAPS-ing” /ˈmɑrdʒən kəˈlæpsɪŋ/

What happens when the bottom margin of one block meets the top margin of the next: they merge into one gap the size of the larger margin instead of adding up.

What is margin collapsing?

Margin collapsing is when the top and bottom margins of two blocks next to each other merge into one, using the larger of the two instead of adding them.

h2 { margin-bottom: 20px; }
p  { margin-top: 12px; }
/* the gap between them is 20px, not 32px */

In a sentence

  • “Because of margin collapsing, the 20px and 30px margins between my two paragraphs made a 30px gap, not 50px.”

Level: Apprentice · More CSS terms at this level

Updated