at-rule

@layer — CSS reference

Declares layer order with a statement or assigns rules using a block. Named layers can be reopened; anonymous layers are distinct and cannot be reopened by name. Dotted names create nested layers. First appearance sets the order; reopening does not move a layer. Unlayered declarations inside a parent layer sit after its named children for normal priority.

Formal Syntax & Structure

css syntaxcss
@layer reset, components;@layer components { /* rules */ }@layer { /* anonymous layer */ }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS reference lab</title><style>@layer base,app; @layer app {p {color:#184168}} @layer base {#a {color:#802020}} @layer {#a {color:#006050}} @layer app {#a {color:#802020}}</style><body><p id="a" class="note">Field note</p><p id="b">Control</p></body></html>
CSS Reference