Specificity

The rule that decides which CSS wins when several rules target the same element.

CSS

Roughly: inline style > #id > .class / [attr] / :hover > element. On a tie, the later rule wins.

Example

.nav a beats a; #main a beats .nav a.

← Media query Updated 2026-11-26