cascade layer
A named group of CSS rules, declared with @layer, whose priority in the cascade is set by layer order instead of selector specificity.
In more detail
With @layer reset, components, utilities; a rule in utilities beats any rule in components, however specific. Styles outside all layers beat every layer for normal declarations. For !important declarations the order reverses.
Example
@layer reset, components, utilities;Related terms
- CSS cascade — The CSS process that decides which of several competing rules sets a property on an element.
- specificity — The weight the browser gives a CSS selector, used to decide which rule wins when two set the same property.
- !important — A flag added to a CSS declaration that moves it into a higher-priority group of the cascade, above all normal declarations.
- utility class — A CSS class that does one small job, such as p-4 for padding or text-white for text colour.
Taught in
- CSS Cascade Layers: Taming Specificity Wars with @layer — Frontend Architecture & Web Platform