← Back to miito.dev

Digital Garden

October 21
Garden HubAutomotiveTypeScriptTestingSVGSQLSecurityReactPerformanceNode.jsModdingJavaScriptGame DevDevOpsDesignCSSCommunication
miito.dev
© Brian Dinh (miito.dev)
✕
✕
§ GARDEN · CSS · CLASS OPEN
NODE FILE · ENTRY

Container Queries Change Everything

FILED UNDER · CSS
①Read
②Meta

Components that respond to their own size, not the viewport — the CSS feature we waited a decade for.

Media queries ask: how wide is the viewport? Container queries ask: how wide is my parent? This seemingly small shift fundamentally changes how we architect responsive components. A card component can now be truly portable — it adapts to wherever it's placed, not to the screen it's viewed on.

The Containment Model

To use container queries, declare a containment context with container-type: inline-size. Then child elements use @container rules instead of @media rules. The query resolves against the nearest containment ancestor.

DTNRWORKSHOP ARMAMENTSSN 2012.OTT.0176