I have a confession: for the first couple of years I wrote CSS professionally, I avoided Grid completely. Flexbox was my hammer, and every layout was a nail. Nested flex containers, negative margin hacks, flex-basis: 33.333% . I made it all work, sort of. Then I opened the TechHub dashboard I was building on an actual tablet and watched my carefully nested flexbox layout fold into something that looked like a ransom note.
That was the project that finally forced me to learn CSS Grid properly, through Tailwind's utilities. This post is more or less everything I wish someone had told me before I started.
Why Grid, and why through Tailwind
Flexbox is one-dimensional. It's brilliant for a navbar, a button group, or centering an icon next to text. But the moment you're arranging content in two dimensions, rows and columns that need to stay in sync, flexbox makes you fight for it.
Grid thinks in two dimensions natively.…