Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
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.
Bad example
| 1 | .list > * { margin-bottom: 8px; } |
Explanation (EN)
A universal child rule can silently affect a new unrelated child.
Objašnjenje (HR)
Good example
| 1 | .list > .item { margin-bottom: 8px; } |
Explanation (EN)
The named class narrows the targets while preserving the direct-child relationship.
Objašnjenje (HR)
Notes (EN)
For component-part styling, prefer an explicit class when the parent can contain unrelated children, and preserve selector scope when rewriting.
Exceptions / Tradeoffs (EN)
Universal selectors are appropriate in intentional resets and controlled layout primitives. Do not change direct-child selection to arbitrary descendant selection.