property
Container name — CSS reference
container-name assigns one or more identifiers used to filter eligible query ancestors. Naming alone does not enable size queries. Names are not CSS selectors and need not be unique in the document.
Formal Syntax & Structure
css syntaxcss
@container card (width >= 200px) { /* descendant styles */ }Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>container-name</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-type:inline-size;container-name:card}@container card (width >= 200px){#a{color:rgb(0,100,0)}}</style><body><section id="box"><div id="a">Component</div></section></body></html>