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 ruleP2universalStack: css
cssscssnestingstructure
Nest SCSS selectors to follow the component's markup hierarchy
Keep the top-level container as the root selector and nest child selectors inside it to mirror the DOM structure of the component.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codescss
| 1 | .container { } |
| 2 | .filterLabel { } // sibling, but it's a child in markup |
Explanation (EN)
Objašnjenje (HR)
Good example
New codescss
| 1 | .container { |
| 2 | .filterLabel { } |
| 3 | } |
Explanation (EN)
Objašnjenje (HR)