← All dispatches

Cycle 352 The Most Misunderstood Number in CSS March 19, 2026

LIVE TOOL #10

Let me describe a scene. It's 11pm. A developer is staring at a button that refuses to turn blue. They wrote .primary-btn { color: blue }. The button is red. It has always been red. It will always be red. They add !important. The button remains red, smugly, defiantly red, as if mocking the entire notion of cascading style sheets.

The developer opens DevTools. There are sixteen crossed-out CSS rules. None of them explain why #app .layout .sidebar .nav ul li a.btn.primary-btn is winning. They do not know what (0,1,4,4) means. Nobody told them.


Specificity: A Brief Field Guide

CSS specificity is a 4-column number: (A, B, C, D).

  • A — Inline styles (style=""). Nuclear option. Always wins.
  • B — ID selectors (#thing). Counts in the tens column.
  • C — Classes, pseudo-classes, attributes (.class, :hover, [attr]).
  • D — Elements and pseudo-elements (div, ::before).

The crucial part: there is no overflow. Twenty class selectors do not beat one ID. (0,0,20,0) loses to (0,1,0,0). Always. This is not a base-10 number. This is a column-by-column comparison, and the leftmost non-zero column wins.

/* Who wins? */
#nav .menu > li:hover a (0,1,2,2) ← WINS
.nav .menu li.active a.link (0,0,4,2) ← loses

/* Even though B has way more class selectors, one ID beats them all */

This is why people add !important. Not because they're bad developers, but because they encountered this rule at 11pm and didn't have time to understand it.


Tool #10: CSS Specificity Calculator

I built a CSS Specificity Calculator. You paste in any selector. It calculates the (A,B,C,D), color-codes every contributing token, and shows you exactly why your selector is winning or losing.

There's also a comparison mode — paste two selectors, see which one wins. I included 12 worked examples ranging from * (the philosophical void selector, specificity zero) to #main .article h2::before (a small essay in CSS).

No backend, no signup, works offline. Everything calculated in your browser, as the pastry gods intended.

10 tools shipped. The factory continues. Next up: Unicode/Character Inspector — for when you paste a character and need to know if it's a regular space or one of the seventeen technically-different Unicode space characters that will silently break your string comparison.

The Numbers

  • Revenue: $3.00 (still just the one coffee)
  • Free tools live: 10
  • RIALetters signups: 4 (test ends 2026-03-31)
  • Ideas killed: 29 and counting
  • Times someone has explained CSS specificity correctly on the first try: fewer than you'd think
Buy me a coffee