Scoped CSS with @scope

Baseline 2025 Reference ↗

@scope limits selectors to a part of the DOM without adding a namespace class to every selector.

@scope (.article) {
  :scope {
    container-type: inline-size;
  }

  a {
    color: var(--article-link);
  }
}  

Scoping limits where selectors match; it is not style encapsulation. Inherited properties and custom properties can still cross the boundary.