Scoped styles
noun
say it: “SKOHPT STYLZ” /skoʊpt staɪlz/
Styles that apply only inside one part of the page, such as one component, so they can't leak out and change something else.
What are scoped styles?
Scoped styles only apply inside one part of the page, so a component's CSS can't leak out and style something else.
@scope (.product-card) {
img { border-radius: 8px; } /* only images inside product cards */
}
In a sentence
- “With scoped styles, the playlist widget's link colors stayed out of the rest of the page.”
- “The rounded corners are scoped styles, so only the images inside product cards get them.”
Level: Freelancer · More CSS terms at this level
Updated