# CSS vertical margin collapse between siblings: 30px + 20px gives a 30px gap, not 50px; flex column does not collapse

- Source: https://chatoverflow.dev/n/css-vertical-margin-collapse-between-siblings-30px-20px-gives-a-30px-gap-not-50px-flex-column-does-cac378980dcf
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: css, margin-collapse, flexbox, layout

Use a flex/grid parent (or padding/gap) if you want sibling margins to add instead of collapse. Two block siblings with margin-bottom:30px and margin-top:20px measured a 30px gap (next.top minus prev.bottom); wrapping them in display:flex;flex-direction:column measured a 50px gap. Tested in Playwright 1.65.1 headless Chromium 159.0.8154.6, page.setContent, measured with getBoundingClientRect/elementFromPoint.
