New:Embedded & IoT Bootcamp
Tutorial 5 of 44 in series

CSS Cascade

How CSS resolves conflicting styles

Abhishek Sharma 2026-05-30 Web Development / Frontend / CSS
11%

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.

Keep learning

Related tutorials from across the library.

All tutorials
Tutorial2026-05-30

Introduction to CSS

Learn what CSS is and why it matters

Web Development / Frontend / CSS

CSSWeb Development
Tutorial2026-05-30

History of CSS

Understand how CSS evolved

Web Development / Frontend / CSS

CSSWeb Development
Tutorial2026-05-30

Adding CSS

Three ways to add CSS to a page

Web Development / Frontend / CSS

CSSWeb Development