Calculate and compare the specificity weight of CSS selectors to debug styling conflicts.
CSS specificity is a three-part weight (a, b, c) the browser uses to decide which rule wins the cascade. a counts ID selectors, b counts classes, attributes and pseudo-classes, and c counts type selectors and pseudo-elements. The universal selector * and combinators (>, +, ~, space) contribute nothing. Selectors are compared left-to-right: higher a always beats lower a, then b, then c. Inline styles and !important override everything. Functional pseudo-classes like :not() and :is() add the specificity of their most-specific argument, while :where() contributes zero.
!important. Paste both selectors into this calculator to compare their weights, then either increase specificity (e.g. add a class) or reorganize your cascade so the desired rule wins.:hover, :nth-child, :focus) add to the middle b value just like a class selector. Pseudo-elements (::before, ::after) add to c instead — the same level as element names like div or p.