Beyond Sizes

Container queries learned to monitor not only width, but also parent CSS property values. This is called Style Queries.

How It Works?

You can change child element style depending on what color or variable is set on parent.

.parent { --theme: dark; }

/* If parent has --theme variable equal to dark */
@container style(--theme: dark) {
  .card {
    background: black;
    color: white;
  }
}
Important

This allows creating truly smart components that themselves switch to " dark mode " or " accent state " just by moving to another site block.

Note

Currently, Style Queries support is actively being added to browsers. This is a powerful alternative to bulky selectors like .dark-theme .card.