T
24

How I finally got CSS container queries to work after swearing they were overhyped for months

I fought container queries hard for about 6 months. Thought they were just media queries with extra steps and more typing. Then I had to build a dashboard where each widget had to resize completely independently based on how wide its parent got. Media queries made my code a mess of breakpoints that broke every time someone resized a sidebar. Container queries solved it in about 20 lines of CSS. I still think the syntax is ugly but I'll admit I was wrong. Anyone else have a technique they wrote off at first that ended up saving them?
2 comments

Log in to join the discussion

Log In
2 Comments
lilyt90
lilyt9017d ago
Took me three tries before I saw how clean it made my dashboard widgets.
2
eric359
eric35917d ago
Is the widget thing something you really have to look close to see, or does it just feel cleaner once you realize it's there? It took me a minute too because I kept expecting some big change, but the subtle effect is actually way better for keeping things tidy. Once you spot it, it's hard to unsee the mess before, you know?
4