Dodi’s crates on Mr. Karim’s shelf: set box-sizing, width, padding and border, the browser lays the crates out, and the margin-box sums show which crates fit…
The number one cause of "my 50% column drops down" and "my box is too wide". Knowing content-box from border-box (and why almost every project, Tailwind included, resets everything to border-box) means the size you write is the size you get.
content-box adds padding and border outside width, border-box counts them inside
width: 200px content-box (the default) adds padding and border outside width: 200 + 2×24 + 2×8 = 264. Use box-sizing: border-box.width: 50% columns should sit side by side, the second drops instead Each column ends up wider than 50% because padding and border are added outside. border-box puts them inside the 50%. The global reset *, *::before, *::after { box-sizing: border-box } fixes it for every element.border-box, yet the box still shifts because of margin box-sizing only covers the inside + padding + border. margin is always outside, so 33.333% + margin is still more than a third. Take the margin off with calc(), or use gap in flex/grid.box-sizing to border-box The second crate comes back up: padding and border now sit inside the 50%. Watch the inside number in crate 1’s arithmetic shrink.content-box, type the width calc(50% - 36px) The old way: subtract padding and border yourself. It fits, but every padding change means counting again.border-box, add a margin The crate drops again. Margin never counts in box-sizing: see the orange strips and the bar running past the .row line.33.333%, or calc(100% / 3 - …) when there is margin.