Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP2stack specificStack: css
cssspecificityselectors
Scope CSS overrides with :where() to avoid raising specificity
When excluding or scoping rules, use :not(:where(...)) so the override doesn't accidentally bump specificity and start a specificity war.
PR: hegnar-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codecss
| 1 | p:not(.preflight *) { margin: 0; } /* the :not raises specificity */ |
Explanation (EN)
Objašnjenje (HR)
Good example
New codecss
| 1 | p:not(:where(.preflight *)) { margin: 0; } /* :where keeps specificity at zero */ |
Explanation (EN)
Objašnjenje (HR)