Back
Firefox 151: components can respond to container styles
WebFirefoxCSS

Firefox 151: components can respond to container styles

Novoid

Query a component’s context

Our retrospective May review looks at Firefox 151, released on May 19, 2026. The CSS @container rule supports style() queries, applying styles to children according to their container’s style. MDN notes.

Think at card scale

The same card may appear in a compact list, a dashboard or a detail page. For developers, the interest is expressing that adaptation near the component rather than inferring its entire context from window size. A custom property describing a visual variant can be the starting point for a limited, readable experiment.

Keep the rules understandable

CSS capabilities do not remove the need to define what determines theme or density. Nested conditions without a clear convention can make a change hard to explain. Before expanding the approach, verify a representative variant in the intended browsers and with relevant accessibility preferences. Also distinguish the available feature from experimental extensions: the release notes list the latter separately.