concept

Stylesheet organization — CSS reference

Explicit cascade layers let a stylesheet establish priority across concerns before individual rules are authored. Normal declarations in later layers win over earlier layers even when the earlier selector is more specific; important declarations reverse the layer priority. Unlayered rules need deliberate management.

Formal Syntax & Structure

css syntaxcss
@layer reset, components, overrides;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>stylesheet-organization</title><style>body{margin:8px;font:16px/24px sans-serif;color:black;background:white}#a{box-sizing:border-box}@layer reset,components,overrides;@layer components{#a{color:red}}@layer overrides{.note{color:blue}}</style><body><p id="a" class="note">Layered note</p></body></html>
CSS Reference