The CSS cascade: how conflicting rules are resolved
Answer: The cascade is an algorithm for solving conflicts where multiple CSS rules apply to an HTML element. The cascade algorithm is split into 4 distinct stages. Cascade layers are the @layer CSS rule.
Four stages of the cascade
CSS stands for Cascading Stylesheets.
When more than one rule applies to an element, the cascade is what decides the winner.
The cascade algorithm is split into 4 distinct stages: position and order of appearance, specificity, origin, and importance (including !important).
When every other step of the cascade is equal, the last style will win.
Origin and importance
Authored CSS is not the only CSS applied to a page.
Origin matters: default browser styles and styles from a browser extension also enter the cascade.
Cascade layers
Cascade layers are expressed with the @layer CSS rule.
They give you more explicit control over CSS files so style-specificity conflicts are easier to prevent.
This is useful for large codebases, design systems, and when managing third party styles in applications.
Once styles are layered, the precedence of a layer always beats the specificity of a selector.
See also
Claims
- id: C1 claim: The cascade resolves conflicts when several rules apply to one element. source: S1 evidence: "The cascade is the algorithm for solving conflicts"
- id: C2 claim: The cascade algorithm has four distinct stages. source: S1 evidence: "The cascade algorithm is split into 4 distinct stages"
- id: C3 claim: If every other step is equal, the last style wins. source: S1 evidence: "the last style will win"
- id: C4 claim: Cascade layers use the @layer CSS rule. source: S2 evidence: "Cascade layers (the @layer CSS rule"
- id: C5 claim: Layer precedence beats selector specificity. source: S2 evidence: "the precedence of a layer always beats the specificity of a selector"
Sources
- [S1] The cascade. web.dev. https://web.dev/learn/css/the-cascade . License: CC-BY-4.0. Accessed 2026-11-23.
- [S2] Cascade layers are coming to your browser. Chrome Developers. https://developer.chrome.com/blog/cascade-layers . License: CC-BY-4.0. Accessed 2026-11-23.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: web.dev, The cascade; Chrome Developers, Cascade layers are coming to your browser. CC-BY-4.0 (https://web.dev/learn/css/flexbox). Copyright Google LLC. web.dev text is CC BY 4.0. CC-BY-4.0 (https://developers.google.com/site-policies). Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License. Copyright Google LLC. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: web.dev, The cascade; Chrome Developers, Cascade layers are coming to your browser. CC-BY-4.0 (https://web.dev/learn/css/flexbox). Copyright Google LLC. web.dev text is CC BY 4.0. CC-BY-4.0 (https://developers.google.com/site-policies). Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License. Copyright Google LLC.
Cite this
iinventedlight. 2026. "The CSS cascade: how conflicting rules are resolved." iinventedlight Library, iil:note:nmvqxf46, version of 2026-11-23. https://iinventedlight.com/library/notes/css-cascade/. License: CC-BY-4.0.
@misc{iil_note_nmvqxf46,
author = {{iinventedlight}},
title = {{The CSS cascade: how conflicting rules are resolved}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-23},
url = {https://iinventedlight.com/library/notes/css-cascade/},
note = {Permanent ID iil:note:nmvqxf46. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- css-cascade.schema.json (schema; CC-BY-4.0)
- css-cascade.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/css-cascade.md.