← TechnologyThe essentials of

@layer: ordering style groups before specificity

Publisher: ResumeMaker • 1 source

Published: 22 Oct 2026 13:13 · Updated: 22 Oct 2026 13:13

AI source check: 21 Oct 2026 13:48. This is not editorial approval.

In a few sentences

In brief

Layers help control the cascade between libraries and own rules.

Useful to know

@layer creates named or anonymous layers of the cascade. For normal declarations, the later layer takes precedence over the earlier one before comparing the specificity of the selectors. [1]

Sample declaration is @layer reset, base, components;. The rules are then placed in the corresponding blocks. Normal styles outside layers take precedence over normal styles in them, so mixing requires attention. In !important, the order of layers is reversed. Don't use this technique just as another way to increase the power of individual selectors.

Sources

For further detail and to check the information:

  1. [1] MDN — @layer ↗