Interactive demo
Specificity and cascade visualizer
Compare selectors and see why source order, layers, and specificity should be treated as separate levers.
Live demo
Specificity and cascade visualizer
Expected behavior
Typing a selector updates a simple specificity score and gives a practical override hint.
Accessibility notes
The score is rendered through an output element and updates in a polite live region.
CSS used in this demo
.tool {
display: grid;
gap: 1rem;
max-width: 44rem;
margin: 0 auto;
padding: 1.5rem;
}
.tool h1 {
margin: 0;
font-size: 2rem;
}
label {
display: grid;
gap: 0.35rem;
font-weight: 700;
}
input {
min-height: 3rem;
border: 2px solid #171717;
border-radius: 6px;
padding-inline: 0.75rem;
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.score {
display: inline-grid;
width: fit-content;
min-width: 9rem;
place-items: center;
border: 2px solid #171717;
border-radius: 8px;
background: #f8e8e2;
padding: 0.75rem 1rem;
font-size: 2rem;
font-weight: 800;
}