Tutorial 5 of 44 in series
CSS Cascade
How CSS resolves conflicting styles
Abhishek Sharma 2026-05-30 Web Development / Frontend / CSS
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)
- User Agent - browser default styles
- User - browser preferences (e.g., larger font sizes)
- Author - your CSS (normal declarations)
- Author !important - your CSS with
!important - 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.
Tutorial
Introduction to CSS
Learn what CSS is and why it matters
Web Development / Frontend / CSS
CSSWeb Development
Tutorial
History of CSS
Understand how CSS evolved
Web Development / Frontend / CSS
CSSWeb Development
Tutorial
Adding CSS
Three ways to add CSS to a page
Web Development / Frontend / CSS
CSSWeb Development