- Executors
-
Learn
Learn Python Runnable examples, NumPy, pandas, and more Learn AI / Machine LearningNeural networks, ML and LLMs from scratch Learn C & C++ Pointers, memory, STL, and modern C++ Learn C#C# basics, OOP, LINQ, async, and .NET exercises Learn MatplotlibLine, bar, scatter and pie charts with live visualizers Learn RustOwnership, traits, error handling, and threads Learn GoSlices, interfaces, goroutines, and channels Python Algorithms Search, sorting, recursion, and visualizers O(n) C & C++ Algorithms Compare algorithms implemented in C and C++ Coding for Kids Learn to code by playing!
- QuizzesNew
- ChallengesNew
- For TeachersNew
- Updates
- Buy me a coffee
HTML & CSS Specificity & the Cascade Quiz
This CSS quiz is about the cascade, the algorithm the browser uses to choose one value when several rules set the same property. Expect tricky cases with specificity counting, source order, !important, inheritance, :is() and :where(), and cascade layers.
Sample question
Question 1 of 10What color is the paragraph?
<style>
#intro { color: red; }
p.lead.big { color: blue; }
</style>
<p id="intro" class="lead big">Hello</p>
Show the answer
B. red #intro has specificity (1, 0, 0) and p.lead.big has (0, 2, 1). Columns are compared left to right, so one id beats any number of classes.
What this quiz covers
- Counting specificity as (ids, classes, types)
- Source order when specificity ties
- Inline styles and
!important - Inherited values vs rules that target the element
:is(),:where(),:not()and@layer
Questions people ask
Do I need an account?
No. Anyone can play. Sign in to keep your XP, streak, badges and history.
Can I retake it?
Yes. Your best score is kept, and the questions and answers are shuffled each time.