{"id":375728,"date":"2022-12-13T05:53:56","date_gmt":"2022-12-13T13:53:56","guid":{"rendered":"https:\/\/css-tricks.com\/?p=375728"},"modified":"2022-12-13T05:53:57","modified_gmt":"2022-12-13T13:53:57","slug":"a-few-times-container-size-queries-would-have-helped-me-out","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/a-few-times-container-size-queries-would-have-helped-me-out\/","title":{"rendered":"A Few Times Container Size Queries Would Have Helped Me Out"},"content":{"rendered":"\n
CSS Container Queries are still gaining traction and many of us are getting our hands wet with them, even if it\u2019s for little experiments or whatnot. They\u2019ve got great, but not quite full, browser support<\/a> \u2014 enough to justify using them in some projects, but maybe not to the extent where we might be tempted to start replacing media queries<\/a> from past projects with shiny new container size queries.<\/p>\n\n\n\n They sure are handy though! In fact, I\u2019ve already run into a few situations where I really wanted to reach for them but just couldn\u2019t overcome the support requirements. If I had been able to use them, this is how it would have looked in those situations.<\/p>\n\n\n\n\n\n\n\n All of the following demos will be best viewed in Chrome or Safari at the time of this writing. Firefox plans to ship support<\/a> in Version 109.<\/p>\n\n\n You kind of had to expect this one, right? It\u2019s such a common pattern that all of us seem to run into it at some point. But the fact is that container size queries would have been a huge time-saver for me with a better outcome had I been able to use them over standard media queries.<\/p>\n\n\n\n Let\u2019s say you\u2019ve been tasked with building this card grid with the requirement that each card needs to keep it\u2019s 1:1 aspect ratio:<\/p>\n\n\n\nCase 1: Card grid<\/h3>\n\n\n