IT lexicon › Web › Cascade layers

Cascade layers @layer

Web På svenska → Updated: 2026-07-30

CSS mechanism that inserts a new step into the cascade above specificity: which layer a rule belongs to is decided before how specific it is.

The classic misery is a third-party library whose .btn.btn-primary beats your own .btn, so you answer with a more specific selector, then another, and finally !important. With @layer reset, library, components, utilities; the order is declared once up front, and a plain class selector in the last layer beats anything in the first. The order is fixed by where the layers are first named, not where the rules are written, which means imports can appear in any order. One detail that surprises people: styles that are in no layer at all beat every layered style. Supported in all major browsers since 2022.

← Back to the lexicon