style()

Experimental

A part of container queries that lets you style elements based on the computed value of a CSS property (usually a custom property) on their parent container, rather than just size.

Quick example

/* Change theme based on parent's --theme variable */
@container style(--theme: dark) {
  .card {
    background: #222;
    color: #fff;
  }
}

style() Browser Support

Limited availability 0% global usage

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Not ready for production without a fallback.

Interop 2026 focus area ? Learn more →
ESC