← Back to release summary

Element's matchContainer()

Category
CSS
Type
New or changed feature
Status
Proposed (Chrome Proposed)
Intent stage
None

Summary

Introduce matchContainer() on Element instances for the container query, that provides a similar mechanism to window.matchMedia().

Motivation

CSS Media Queries have a method window.matchMedia(), which gives a script the ability to listen for media query changes. Web Devs proposed that CSS Container Queries have the same functionality. And then, CSSWG resolved this proposal as "RESOLVED: Add a matchContainer method as proposed in issue. Keep issue open to decide if need new observer or if we can reuse the existing".

Standards & signals

Ecosystem

Explainers: https://github.com/w3c/csswg-drafts/issues/6205

View on chromestatus.com