Semver Comparator
Compare two semantic versions and test them against a range.
Score a selector and find out which of two rules actually wins.
The Specificity Calculator scores a selector, breaks out what each part contributes, and compares two selectors to say which rule wins — including the tie case where source order decides.
Specificity decides which rule wins when two of them set the same property, and it is scored as three numbers: ids, classes, and elements. Paste a selector and each part is broken out with what it contributes, so the total is explained rather than asserted.
Comparing two selectors is the question people actually have. Paste both and the calculator says which one wins and why — including the case where they tie and source order decides, which is the one that produces the most confusion. The modern pseudo-classes are handled properly: :where() contributes nothing at all by design, while :is(), :not() and :has() take the specificity of their most specific argument.
Paste two selectors and the calculator says which wins and why, which is the actual question behind the visit.
Each id, class, attribute, pseudo-class and element is listed with what it contributes, so the total is derived rather than asserted.
:where() contributes nothing by design, while :is(), :not() and :has() take their most specific argument.
Equal specificity means source order decides, which is stated explicitly rather than left as an unexplained draw.
Where they sit relative to selectors, and why an inline style is so hard to override.
Anything from a single class to a long descendant chain.
Every part is listed with what it contributes to the score.
Paste a second one and the calculator says which wins, and why.
Equal specificity means source order decides, which is called out explicitly.
As three counts: ids, then classes, attribute selectors and pseudo-classes, then elements and pseudo-elements. They compare left to right, and a single id beats any number of classes.
Nothing, which is the entire point of it. :where(#header, .nav) a scores as just the element, so it is the way to write a broad selector that is trivial to override.
More than any selector — it sits in a fourth position ahead of ids. Only !important beats it, which is why an inline style is so hard to override and best avoided.
The one that appears later in the source. That is why load order matters, and why a stylesheet included after a framework can override it without any specificity games.
What people who use the CSS Specificity Calculator think of it. Reviews come from visitors and are posted as written.
No ratings yet
Yours would be the first.
0 reviews
Newest first
No reviews yet
Be the first to rate the CSS Specificity Calculator. It takes half a minute and no account.
Write the first reviewCompare two semantic versions and test them against a range.
Draw a clipping shape with draggable points and get the CSS.
Turn an array of JSON records into INSERT statements, with an optional CREATE TABLE.
Convert tab-separated data — or a spreadsheet paste — straight into JSON.
Encode and decode Base32, including the Crockford and hex variants.
Turn text, SVG or a small file into a data: URI you can inline anywhere.
Collapse nested JSON into one flat level of dot-notation or bracket keys.
Generate Kotlin data classes with Gson or kotlinx.serialization annotations.