CSS cascade layers (@layer) solve long-standing specificity battles. Understanding this vocabulary is increasingly important as design systems and CSS frameworks adopt layers.
0 / 5 completed
1 / 5
A CSS developer says: 'Wrap the third-party styles in a cascade layer to prevent specificity conflicts.' What is a cascade layer?
Cascade layers (@layer) divide CSS into explicitly ordered layers. Styles in a later layer override earlier layers, regardless of selector specificity. This solves the classic problem of third-party CSS specificity battles — by putting third-party styles in an early layer, your own styles always win. In discussions: 'put it in a layer' means use @layer utilities { ... } to control cascade order.
2 / 5
A developer explains: '@layer base, components, utilities — this declares the layer order.' What does this mean?
Declaring @layer base, components, utilities at the top of a stylesheet establishes the cascade order: later-listed layers have higher priority. utilities wins over components which wins over base. This happens regardless of where the actual CSS rules appear in the file or their selector specificity. It's a way to make cascade order explicit and predictable.
3 / 5
A PR review says: 'The unlayered styles are overriding the layered ones — that's expected behaviour.' Why?
CSS unlayered styles (written outside any @layer) automatically have higher cascade priority than any layered style. This is by design — if you add @layer to adopt a framework but write your own styles normally, your styles always win. In migration discussions: 'move your overrides outside any layer' is advice to ensure they always take precedence.
4 / 5
A developer says: 'Use revert-layer to roll back a style to the previous layer's value.' What does this mean?
revert-layer is a CSS keyword that acts like revert but only within the cascade layer context — it removes the current layer's contribution, revealing what the next lower layer would have set. Useful in component libraries where you want to offer a 'clean slate' within a layer. In discussions: 'use revert-layer' means opt out of a layer's styles for specific properties.
5 / 5
An architect says: 'The layer import syntax lets us assign third-party CSS to a layer at import time.' What is this pattern?
Layer imports use the syntax @import 'library.css' layer(third-party) to immediately assign all imported styles to a named layer. This is the cleanest way to adopt a CSS library without specificity battles — all its rules sit in a lower-priority layer than your own unlayered styles. In discussions: 'import it into a layer' means use this pattern rather than manually wrapping each imported file.