What is Margin Collapse in CSS? And How to Avoid It

1 · freeCodeCamp.org · Jan. 11, 2022, 6:22 p.m.
What is Margin Collapse?Margin collapse occurs when vertically adjacent margins of block-level elements collide to share a general margin space. The size of this shared space is dictated by the larger number margin. You can visualize this as an arm wrestling match, where the larger margin will take over...