concept

Named container query — CSS reference

A named query only considers eligible ancestors with the requested name. A container named card is not selected by a query for other. If there is no matching eligible ancestor, the condition cannot apply.

Formal Syntax & Structure

css syntaxcss
@container other (width >= 200px) { /* descendant styles */ }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>named-container-query</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}#box{width:240px;container:card / inline-size}@container other (width >= 200px){#a{color:rgb(0,100,0)}}</style><body><section id="box"><div id="a">Component</div></section></body></html>
CSS Reference