← Back to at-rules

CSS At-rule

@layer

Structure

Declares a cascade layer, giving explicit control over the order of style precedence.

Syntax

@layer name { }

Example

@layer base, components, utilities;

Common use cases

  • Organizing CSS by concern without specificity wars
  • Third-party styles that shouldn't override yours
  • Design system architecture

Practical developer insight

Layers declared later win over earlier ones regardless of specificity — this makes @layer a powerful tool for managing CSS architecture at scale.

Related