Sat 10 Jun 2023

An introduction to @scope in CSS

In January 2019 I raised an issue in the W3C CSS GitHub titled Please bring back scoped styles. There had once been a scoped HTML attribute but it got deprecated. It’s been replaced by @scope in CSS. Browser support is still forthcoming. It’s due to land in Chrome 117. Safari has a positive position on the specification.

There are two selling points of @scope: styling based on proximity and setting a lower boundary for a selector.

Source: An introduction to @scope in CSS, an article by Ollie Williams.