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
cssselectorsmaintainability
Avoid the universal selector; target explicit classes
Prefer explicit class selectors over `*` or `& > *`. The universal selector is opaque about what it styles, applies broadly, and is easy to leak or mis-scope; a named class documents intent and limits the blast radius.
PR: profico-org-corpus batch2 (all stacks/products)Created: Jul 26, 2026
Bad example
Old codescss
| 1 | .list > * { margin-bottom: 8px; } |
Explanation (EN)
It's unclear which elements this targets and it hits every direct child indiscriminately.
Objašnjenje (HR)
Good example
New codescss
| 1 | .list .item { margin-bottom: 8px; } |
Explanation (EN)
A named class states exactly what is styled.
Objašnjenje (HR)