CSS Output Prediction Medium +20 XP
Specificity Winner
Which rule applies to <p class='text' id='main'>?
CSSRead-only
p { color: blue; }
.text { color: green; }
#main { color: red; }What is the output?
Show answer and explanation
Answer: red (ID wins)
CSS specificity: ID (100) > class (10) > element (1). The #main rule has highest specificity.
Hint: IDs have the highest specificity.
What this challenge tests
Output Prediction in CSS: specificity, selectors.