{"id":296609,"date":"2019-10-09T06:56:13","date_gmt":"2019-10-09T13:56:13","guid":{"rendered":"https:\/\/css-tricks.com\/?p=296609"},"modified":"2019-10-09T06:56:13","modified_gmt":"2019-10-09T13:56:13","slug":"lets-not-forget-about-container-queries","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/lets-not-forget-about-container-queries\/","title":{"rendered":"Let’s Not Forget About Container Queries"},"content":{"rendered":"

Container queries are always on the top of the list of requested improvements to CSS. The general sentiment is that if we had container queries, we wouldn’t write as many global media queries based on page size. That’s because we’re actually<\/em> trying to control a more scoped container, and the only reason we use media queries for that now is because it’s the best tool we have in CSS. I absolutely believe that. <\/p>\n

<\/p>\n

There is another sentiment that goes around once in a while that goes something like: “you developers think you need container queries but you really don’t.” I am not a fan of that. It seems terribly obvious that we would do good things with them if they were available, not the least of which is writing cleaner, portable, understandable code. Everyone seems to agree that building UIs from components is the way to go these days which makes the need for container queries all the more obvious.<\/p>\n

It’s wonderful that there are modern JavaScript ideas that help us do use them today — but that doesn’t mean the technology needs to stay there. It makes way more sense in CSS.<\/p>\n

Here’s my late 2019 thought dump on the subject:<\/p>\n