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
cssselectorsdry
Include the base state in a grouped pseudo-class selector list
When several pseudo-class states share styling, include `&` in the comma-grouped selector list rather than duplicating the same rule for the base element separately.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codescss
| 1 | .link { color: red; } |
| 2 | .link:hover, .link:focus { color: red; } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codescss
| 1 | .link { |
| 2 | &, &:active, &:visited, &:focus, &:hover { color: red; } |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)