Skip to content

Master CSS Specificity by Fighting with It

Add selectors that target the same element and watch them battle for control.

Battle Arena

<div class="target">
I'm the target element — what happens to me?

No selectors yet. Add one below or load a preset to start a battle.

Specificity Scale

TypeScoreExample
ID1-0-0#main
Class0-1-0.active
Attribute0-1-0[href]
Element0-0-1div
Universal0-0-0*

Cheat Sheet

!importantOverrides all
Inline style1-0-0-0
#id1-0-0
.class + p0-1-1
div p0-0-2

Quick Tips

Order matters: When specificity ties, the later rule wins.

Combine counts: .a .b = 0-2-0, not 0-1-0.

Descendants count: div .class = 0-1-1.

Pseudo-classes: :hover = 0-1-0.

Pseudo-elements: ::before = 0-0-1.

🏆 Challenge Mode

Score: 0 / 0
Click Next Challenge to start testing your specificity knowledge!

⚡ Quick Presets