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

推荐订阅源

O
OpenAI News
Latest news
Latest news
T
Threat Research - Cisco Blogs
Project Zero
Project Zero
V
Vulnerabilities – Threatpost
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
T
Threatpost
N
News | PayPal Newsroom
I
Intezer
L
LINUX DO - 热门话题
The Hacker News
The Hacker News
H
Hacker News: Front Page
P
Proofpoint News Feed
S
Secure Thoughts
H
Help Net Security
S
Schneier on Security
TaoSecurity Blog
TaoSecurity Blog
S
Security Archives - TechRepublic
V
Visual Studio Blog
博客园 - 司徒正美
博客园 - Franky
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
AI
AI
V
V2EX - 技术
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
WordPress大学
WordPress大学
AWS News Blog
AWS News Blog
罗磊的独立博客
C
Cyber Attacks, Cyber Crime and Cyber Security
Webroot Blog
Webroot Blog
Forbes - Security
Forbes - Security
Engineering at Meta
Engineering at Meta
MyScale Blog
MyScale Blog
N
News and Events Feed by Topic
大猫的无限游戏
大猫的无限游戏
L
Lohrmann on Cybersecurity
H
Heimdal Security Blog
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
DataBreaches.Net
Blog — PlanetScale
Blog — PlanetScale
小众软件
小众软件
Recent Commits to openclaw:main
Recent Commits to openclaw:main
B
Blog
T
Troy Hunt's Blog
Stack Overflow Blog
Stack Overflow Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com

Miriam Eric Suzanne

Butter bells, fresh from the kiln Butter bells, fresh from the kiln Butter bells, fresh from the kiln I had to look it up I Laser-cut pottery throwing gauge Tech continues to be political Aggregating my distributed self A web component for CodePen embeds? We don Eleventy buckets & cascade layers A slash-why proposal User styles on the web Custom element, two ways New year, same (terrible) Mia CSS @scope Reclaiming my time Cascade Layers Javascript automation on Mac Personal Histories Ancient Web Browsers Critical CSS? Not So Fast! CSS tie-dye gradient backgrounds Personal website redesign Request for Comments: Sass Color Spaces A long-term plan for logical properties? Container queries in browsers! I never let things be small A whole cascade of layers This content won No demo [website] reno 2 days of cordwainery Body margin 8px The gray areas of HWB color Miriam, for the archive Complex vs compound selectors The spam has arrived Am I on the IndieWeb yet? My theatrical delusions A Complete Guide to CSS Cascade Layers Very Extremely Practical CSS Art An open CSS notebook Custom Property “Stacks" Alcohol affects the frontal cortex Embracing the Universal Web CSS most normalizer-est Introducing Sass Modules F*CSS Not clear to me, an installation Framed | Born to choose this way Last Bullet, live music video A Dark Plain, live music video Guts | Let Rejecting maleness Chosen family (thank you) Mia Speaking of pride More CSS Charts, with Grid & Custom Properties (Mis)gender Stop Being Productive Fun with Viewport Units Gods on the Lam Body & gender fragments Trans Interviews & Photography Getting Started with CSS Grid Just Like That Adaptation: SideSaddle/Myths Justice [under construction] Some clarifications on trans language Some kind of resistance tour Loops in CSS Preprocessors An Interview with Miriam Suzanne Estrogentrification Miriam, a how-to guide Holes / SideSaddle midwest tour Underground music showcase Species of the stars PROPHETIA VETITUM MUNDI Pig Sez, song demo I'm Not Ready To Go Yet, song demo UMS day 4 (the end) UMS day 3 A Dark Plain, song demo UMS day 2 UMS day 1 Media Archeology Lab, Artist in Residence Stratified design (re)Thinking on your feet Five(5), song demo Poetry readings are terrible Explosive growth
Container queries explainer & proposal
2021-05-02 · via Miriam Eric Suzanne

Media-queries allow an author to make style changes based on the overall viewport dimensions – but in many cases, authors would prefer styling modular components based on their context within a layout.

bookmark of CSS Sandbox

My proposal builds on David Baron’s @container proposal, which works by applying size & layout containment to the queried elements. Any element with both size & layout containment can be queried using a new @container rule, with similar syntax to existing media-queries.

The approach has been approved by the CSS Working Group, to be added in CSS Containment Level 3, with me as one of the authors.

See the Contain 3 Project for issues and progress.

Establishing Containers

The first step is to establish containers. Any element can become a container, by adding layout, size (generally inline-size), and style containment:

/* Establish containers */
main, aside {
  contain: layout inline-size style;
}

This syntax works in the prototype, but is clearly not ideal for readable and clear code. There is an open issue to discuss better syntax for establishing query containers

Note: See the Editor’s Draft Specification for the latest syntax. The Chrome prototype already has basic support for container-type and container-name.

Writing Queries

Each container creates a containment context that can be queried by their descendant elements. We can query the current containment context (the nearest ancestor container) using an @container rule that is very similar to existing @media queries:

/* Change styles according to container size */
@container (min-width: 35em) {
  .media {
    grid-gap: 1rem;
    grid-template: "media content" auto / max-content 1fr;
  }
}

The .media class above is now responsive to any container it is in. Each instance of the .media class will query its nearest container.

That means we can have one .media element that moves around, responding to the context we put it in – or multiple .meia elements, each one responding individually to its own location.

Prototype

Chrome has released a prototype in their nightly build. To experiment with the feature, and leave feedback while it is still in development:

  1. Download Chrome Canary,
  2. Go to chrome://flags in the url bar, and
  3. Search for “CSS Container Queries” & enable the experimental feature
  4. Restart the browser

This is a draft prototype and may not match the final design.

Demos & Articles

For a quick introduction, check out:

Or dig into more resources, for the full details:

© Miriam Eric Suzanne,
protect trans kids