Patterns

Container query in component CSS

Use an eligible ancestor with inline-size containment and style descendants according to its width.

Formal Syntax & Structure

react syntaxreact
@container (min-width: 36rem) { .catalog { grid-template-columns: repeat(2, 1fr); } }

Working Example

Example Snippetreact
.exhibit { container-type: inline-size; }
React Reference