惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MyScale Blog
MyScale Blog
Jina AI
Jina AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
博客园 - 司徒正美
Martin Fowler
Martin Fowler
T
Tailwind CSS Blog
B
Blog RSS Feed
Vercel News
Vercel News
博客园 - 聂微东
I
InfoQ
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
M
MIT News - Artificial intelligence
Recent Announcements
Recent Announcements
GbyAI
GbyAI
L
LangChain Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Security Blog
Microsoft Security Blog
C
Check Point Blog
MongoDB | Blog
MongoDB | Blog
B
Blog

Matthias Ott

Hello Again, World This, Still Not for Everyone The Shape of Friction WeissKlang L1 – Punching Above Its Weight Continvoucly Morged Value Webspace Invaders To Affinity and Beyond The Mystery of Storytelling Amateurs! Echoes of Connection Linear() Is Not (That) Linear View Transitions: The Smooth Parts Adding AVIF and WebP Support to My Craft CMS Site Challenge Acoustic Room Treatment and Building Sound Panels, Part 1: Planning Play On Overshoot The HTML Output Element Listening Closely Compressed Fluid Typography The Lifeblood of the Web What Could Go Wrong? That’s My Rank Making Space CSS :is() :where() the Magic Happens Visual Regression Testing for External URLs With Playwright Jane Goodall’s Famous Last Words European Tech Alternatives 🇪🇺 Independent Type Foundry Advent Calendar – Day 24: NaN Independent Type Foundry Advent Calendar – Day 23: Typotheque
Uncontainable Container Query Excitement · Matthias Ott
Matthias Ott · 2023-02-16 · via Matthias Ott

CSS Container Queries are now available in all major browsers. 🥳 With the release of Firefox 110 yesterday, the stable versions of Chrome, Safari, Edge, and Firefox all support them. There have been many major additions to CSS in recent years, but this one is definitely one of the most impactful game changers. Being able to use not only features of the browser viewport but the dimensions (or other characteristics) of individual containers to change our layouts will once more fundamentally change the way we create responsive and even more flexible layouts on the Web.

During work on the spec, the syntax for Container Queries changed several times. This is also why I held back on writing a longer post exploring container queries in the past. Now, however, the syntax for size queries and units is stable and you can start to use Container Queries in production. So make sure that you use the correct syntax – Miriam has written about this – and that you progressively enhance your layout, of course, so that people with older browsers (which will still be the majority of users for a little bit of time) get a solid baseline experience.

I personally can’t wait to use them more often from now on and I’m sure that if you keep your eyes open, opportunities to effectively apply container queries will surface everywhere, just as with :has(). And particularly because they work so well on smaller elements, I’m quite sure that there will be plenty of ways to also use them without breaking our layouts in older browsers.

And I also can’t wait to see all your demos and best practices emerge. 🎉

~

Here are a few fantastic posts and examples to get you started:

Day 56: container queries, by Manuel Matuzović
https://www.matuzo.at/blog/2022/100daysof-day56/

Use the Right Container Query Syntax, by Miriam Suzanne
https://www.oddbird.net/2022/08/18/cq-syntax/

A Primer On CSS Container Queries, by Stephanie Eckles
https://www.smashingmagazine.com/2021/05/complete-guide-css-container-queries/

CSS container queries are finally here, by Ahmad Shadeed
https://ishadeed.com/article/container-queries-are-finally-here/

A CodePen collection of container query examples by Miriam Suzanne
https://codepen.io/collection/XQrgJo

~

9 Webmentions

5 Reposts

3 Likes

ⓘ Webmentions are a way to notify other websites when you link to them, and to receive notifications when others link to you. Learn more about Webmentions.