property
Container type — CSS reference
container-type establishes eligibility for size queries. inline-size enables queries on the inline axis; size enables both axes. normal does not enable size queries but can still serve style queries. Size containment changes intrinsic sizing, so supply appropriate dimensions or let the outer layout allocate them.
Formal Syntax & Structure
css syntaxcss
@container (inline-size > 200px) { /* descendant styles */ }Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>container-type</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 (inline-size > 200px){#a{color:rgb(0,100,0)}}</style><body><section id="box"><div id="a">Component</div></section></body></html>