Mrs. Yanti’s display board: space the goods with margins, :not(:last-child), the owl, or gap, in flex, grid or block flow, and the browser measures what is…
"Use gap, not margin" is modern layout advice, but most people only see why after meeting the edge leftovers, a menu that is not really centred, a messy wrap, and a space that suddenly doubles when block becomes flex. gap also does not care about order or hidden items, while :not(:last-child) depends on HTML order.
margin sticks to items, gap only lives between them
gap on the container (only between items), or patch with :not(:last-child) if the line never wraps.margin-right does not space lines, and margin-bottom adds a leftover under the last line. gap fills row-gap and column-gap at once.gap only works in CSS Grid gap works in flexbox (every modern browser since 2021), grid and multi-column. In plain block flow it does nothing.margin: 12px 0 becomes 24px between boxes. Use gap on the container.margin, then set justify-content: center The red line (the line’s middle) sits off the dashed one (the board’s middle): the last item’s margin gets centred too.gap The red leftover at the end disappears: gap only sits between items, none at the edges.flex-wrap + gap Space between items and between lines, with no red leftover at all. One property, two axes.margin in block, then switch to a flex column In block flow meeting margins collapse (12 + 12 → 12); in flex they add up (24). Watch the label between the boxes.