Cascade
The algorithm deciding which declaration wins when several apply to the same element.
The cascade is CSS's conflict-resolution algorithm. When multiple declarations target the same property on the same element, the winner is chosen by, in order: origin and importance, cascade layer, specificity, and finally document order.
Specificity is the part most people internalize — a count of identifiers, classes, and element names in the selector, compared component-wise so that no number of class selectors ever beats a single identifier selector. It is why specificity wars escalate: the reliable way to win is to be more specific, and the result is a stylesheet where nothing can be overridden without escalating further.
Modern CSS provides better tools. Cascade layers let you declare precedence explicitly, independent of specificity, so a design system's rules can be authored at low specificity and still lose to consumer overrides on purpose. Utility-first approaches sidestep the problem by keeping every rule at the same low specificity; see Utility-First CSS.
Understanding the cascade also explains a class of cross-application bugs: styles from one application's administrative interface leaking into another's front end and pinning a root-level property, breaking an inherited background further down. The symptom appears at the leaf; the cause is a declaration that won at the root.
See also4
CSS Custom Property
A user-defined CSS property that participates in the cascade and inherits down the tree.
Design & Interface12 connections
Scoped Styling
Confining a set of style decisions to a subtree so the same component can look different in different contexts.
Design & Interface11 connections
Cascading Style Sheets
The language that describes how web pages look, proposed in 1994 to separate presentation from structure, nearly sunk by inconsistent browser support, and grown since into a layout and animation system that does work once reserved for scripts.
Web Platform11 connections
Root Cause Analysis
Escalating past the visible symptom until you find the layer that actually produced it.
Method49 connections
Related7
Nearby in the graph rather than deliberately chosen. Looser, sometimes surprising.
Linked from8
- Box ModelDesign & Interface
The rule that every element on a web page is a rectangle of content wrapped in padding, border, and margin, and the two quirks, box sizing and collapsing margins, behind most surprises in CSS spacing.
- Cascading Style SheetsWeb Platform
The language that describes how web pages look, proposed in 1994 to separate presentation from structure, nearly sunk by inconsistent browser support, and grown since into a layout and animation system that does work once reserved for scripts.
- CSS Custom PropertyDesign & Interface
A user-defined CSS property that participates in the cascade and inherits down the tree.
- CSS-in-JSWeb Platform
Writing a component's styles in JavaScript alongside its markup and logic, so styles are scoped automatically and can depend on the component's state, an approach popular in the React era whose runtime costs led to build-time variants.
- Design TokenDesign & Interface
Named design decisions — color, spacing, radius, type — stored as data so they can be shared and re-themed.
- OKLCHDesign & Interface
A perceptually uniform color space that makes lightness and chroma behave predictably.
- Scoped StylingDesign & Interface
Confining a set of style decisions to a subtree so the same component can look different in different contexts.
- Utility-First CSSDesign & Interface
Composing styles from many small single-purpose classes rather than authoring semantic rules.