demo · v149
Breakpoint Matrix
Five frames at fixed widths — 220, 280, 360, 540, 720 — each running the same comma-separated @container rule. The rule mixes a container-size branch and a style() branch fed by the reduced-motion user preference, so a single declaration handles both axes.
Observing rendered tiles…
the rule
/* Bridge the user preference into a custom property … */
.matrix { --roomy: off; }
@media (prefers-reduced-motion: reduce) {
.matrix { --roomy: on; }
}
/* … then OR it with a size branch in ONE @container rule */
@container tile (min-width: 360px), tile style(--roomy: on) {
.tile {
background: emerald-tinted;
font-family: display;
font-size: 1.4rem;
}
}
Only one branch needs to match. Note what you can't write: @container tile (min-width: 360px), (prefers-reduced-motion: reduce) parses — the comma list tolerates an unknown branch — but a media feature inside @container is evaluated as unknown and never matches. Route media/user-preference signals through a custom property and a style() branch, as above.
read it back from CSSOM
const rule = [...document.styleSheets[0].cssRules]
.find(r => r.constructor.name === 'CSSContainerRule');
console.log(rule.conditionText);
// "tile (min-width: 360px), tile style(--roomy: on)"
see also
- Comma-separated Container Queries — feature index
- Fallback Query — resize playground
- ChromeStatus entry
- CSS Conditional Rules 5 spec
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗