html-css

CSS Grid: A Journey Through Interactive Learning

I learned CSS Grid by playing games. Seriously.

4 May 2024

I learned CSS Grid by playing games. Seriously.

Reading documentation is fine for reference. But for building intuition about how grid tracks, placement, and alignment actually work, interactive tools beat docs every time. Here are the three I keep coming back to.

CSS Grid Garden

https://cssgridgarden.com/

A puzzle game where you water a garden using CSS Grid properties. Each level introduces a new concept — defining rows and columns, spanning tracks, positioning items.

It starts simple and ramps up gradually. By the time you finish, you've internalized properties like grid-column, grid-row, and grid-template-areas through repetition, not memorization.

Good for: Beginners and anyone who wants a quick refresher on the fundamentals.

CSS Grid Attack (Coding Fantasy)

https://codingfantasy.com/games/css-grid-attack

A game with a storyline where you solve grid challenges to progress. It's more complex than Grid Garden and covers advanced concepts.

The gamification makes it surprisingly engaging. I expected to play for 10 minutes and ended up spending an hour.

Good for: Intermediate developers who already know the basics and want to push further.

Grid by Example

https://gridbyexample.com/

Built by Rachel Andrew, one of the people who helped create the CSS Grid spec. This isn't a game — it's a comprehensive collection of examples with explanations.

Some highlights worth studying:

Good for: Deep understanding. When you need to know why something works, not just that it works.

My Take

CSS Grid replaced a lot of hacks I used to rely on — float-based layouts, flexbox gymnastics for two-dimensional positioning, absolute positioning nightmares.

Benefit: Grid handles two-dimensional layouts natively. Rows and columns at the same time, with clean syntax.

Cost: Browser support for the more advanced features (like subgrid) is still catching up. And the learning curve is real — Grid has a lot of properties, and it takes time to develop intuition for how they interact.

The best way to build that intuition? Play the games. Then build something real.