You've got a row of cards and you're staring at your CSS. Flexbox or grid? You try one, it almost works, you add a few more lines, and now it looks right but you couldn't say why. Today I'll give you the one question that settles it, and we'll run both on the same real layouts so you can watch the difference yourself.
Here's the short answer, so you have it before anything else. Use flexbox when the content should decide the size of things, like a row of tags or a navigation bar. Use grid when the layout should decide the size of things, like a wall of cards or a whole page. Most real pages use both: grid outside, flexbox inside.
That's the whole idea. The rest of this article is you seeing it with your own eyes. Every example below is live, so click the buttons. If you're a beginner, read it top to bottom. If you already use both every day, jump to the section about content that won't shrink, because that's the bug that costs people whole afternoons.…