CSS Cascade ยท Astro Tech Blog

Cascade

The cascade is the algorithm that resolves conflicting style declarations. When multiple rules apply to the same element, the cascade determines which one wins.

Cascade Order (lowest to highest priority)

  1. User Agent โ€” browser default styles
  2. User โ€” browser preferences (e.g., larger font sizes)
  3. Author โ€” your CSS (normal declarations)
  4. Author !important โ€” your CSS with !important
  5. User !important โ€” user styles with !important
Demo: Cascade in Action
HTML
<p class="description">Which color wins?</p>
CSS
/* All three rules target the same element */
p { color: #64748b; }
.description { color: #6366f1; }
p.description { color: #059669; }
Live Output Window

Within the same origin, specificity and source order break ties:

/* Later rules override earlier ones when specificity is equal */
p { color: red; }
p { color: blue; } /* blue wins */

Key Takeaway

Think of the cascade as a scoring system: later in the stylesheet beats earlier, and more specific beats less specific.