Container Queries in Real Projects
Container queries let one card design work in a sidebar and a grid.
Where they paid off
Performance was not the goal, but it came along anyway. Fewer styles, fewer scripts and fewer images add up quickly.
- Cards reused across layouts
- Sidebar widgets
- Pricing tables
The first version looked plain. The second version looked busy. The third version, with half the details removed, is the one we kept.
Media queries ask about the window. Components care about their box.
We asked a few readers to try it with a keyboard only. Two of them found problems in under a minute, which is exactly why we asked.
Browser support is no longer the excuse it used to be. Everything in this post works in every current browser without a fallback.
If you only change one thing after reading this, make it the spacing. Consistent gaps make even a rough layout look intentional.
Colour is the last thing we add. Getting the structure right in black and white first saves a lot of arguing later.
None of this is new. It is the same advice print designers have given for a century, moved onto screens.
11 thoughts on “Container Queries in Real Projects”
Clear, short and useful. More like this, please.
Good question. We cover that in a follow-up post soon.
Agreed, this is how we do it too.
How long did the whole redesign take you?
Thanks for reading, glad it helped.
Seconded. More posts like this.
The screenshots sold me. Going to rebuild our card grid this weekend.
Agreed, this is how we do it too.
Tried it in Safari and it works perfectly.
Shared this with my students today.
Clear, short and useful. More like this, please.