Calculate and compare CSS selector specificity using the browser cascade tuple.
The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.
Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.
ID, class/attribute/pseudo-class, and type tokens form a three-part specificity tuple; inline styles and !important are evaluated by cascade rules separately. Tuples compare lexicographically after origin and importance.
#header .nav a .nav a:hover div.container p
#header .nav a Specificity: (1, 1, 1) Score: 111 IDs: 1, Classes/Attrs: 1, Elements: 1 .nav a:hover Specificity: (0, 2, 1) Score: 21 IDs: 0, Classes/Attrs: 2, Elements: 1 div.container p Specificity: (0, 1, 2) Score: 12 IDs: 0, Classes/Attrs: 1, Elements: 2 --- Sorted by specificity (highest first) --- (1, 1, 1) - #header .nav a (0, 2, 1) - .nav a:hover (0, 1, 2) - div.container p
Override debugging, code reviews, and design-system guidance calculate specificity.