@container style()

Lets you apply styles based on the value of a container's custom property, like @container style(--theme: dark), instead of only its size.

Quick example

@container style(--theme: dark) {
  .card {
    background: #1e1e2e;
    color: #cdd6f4;
  }
}

@container style() Browser Support

Newly available Since 2026 88% global usage

Since 2026 this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

Works in all modern browsers. May need a fallback for older browsers.

111+
151+
18+
111+
ESC