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
The rule that decides which CSS wins when several rules target the same element.
Roughly: inline style > #id > .class / [attr] / :hover > element. On a tie, the later rule wins.
.nav a beats a; #main a beats .nav a.