New series: what assistive tech really hears on your checkout page. Start with part one →
Shipwright
Home
CSS Sep 18, 2026 2 min read 1.2k views

Twelve Card Layouts Built with Nothing but CSS Grid

Mara Okafor

Mara Okafor

@maraokafor

Share
Cover illustration for the article Twelve Card Layouts Built with Nothing but CSS Grid

A visual catalogue of card patterns and the grid declarations behind them. Most CSS problems we see in reviews are not about a missing property. They are about a layout that was never told what it should do when the content changes size, and that is what this piece sets out to fix.

What the examples share

Begin by writing down the smallest and largest sizes the component must survive. Once those two numbers exist, properties such as clamp(), minmax(), and fit-content stop feeling like magic and start reading like a specification.

As always, the examples are simplified to fit on a page. The production version has more error handling and logging, but the shape of the code is the same.

Questions, corrections, and war stories are welcome in the comments. Several of our best follow-up posts started as a reader pointing out something we had missed.

We will revisit this in six months with fresh numbers. If the results change, we will update the post and note what changed at the end.

If you try this on your own project, start with one page or one service rather than the whole codebase. A small experiment gives you real numbers to argue with, and it is easy to roll back if the idea does not fit.

We have been running this approach for several months now. The initial setup took about a day, and the ongoing cost is close to zero once the team knows where to look.

None of this is new, and that is the point. The techniques that last are usually the boring ones that are documented well and supported by the platform itself.

What we would change next time

If you try this on your own project, start with one page or one service rather than the whole codebase. A small experiment gives you real numbers to argue with, and it is easy to roll back if the idea does not fit.

  • Set explicit minimum and maximum sizes first.
  • Prefer intrinsic sizing keywords over fixed pixel values.
  • Let the container decide, not the viewport.
  • Keep one fallback declaration above the modern one.
Mara Okafor

Mara Okafor

Author

Staff frontend engineer focused on CSS architecture and accessibility. Mara has audited more design systems than she can count and still gets excited about a good focus ring.

Related Posts

Comments 6

Elias Lindqvist Member

The part about naming things made me laugh, then made me go rename three functions.

Diego Alvarez

Counterpoint: for small teams the simpler approach in the first section is usually enough.

Mara Okafor Author

Fair point. For a monorepo I would probably split the configuration per package.

Lena Novak

Thanks for catching that, it is fixed now.

Ben Carter

Solid write-up. The warning about caching bit us hard last year.

Ravi Shankar

Shared this with my team. The list near the end is going straight into our pull request template.

Leave a comment

Your email will not be published. Sign in for a faster experience.

Supports **bold**, *italic*, and `code`.