Rules Hub
Code Ruleset
← 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
cssz-indexmaintainability
Comment every z-index so stacking stays controllable
Explain non-obvious stacking relationships or use established layer tokens; inspect stacking contexts before changing z-index.
PR: hegnar-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codecss
| 1 | .modal { z-index: 9999; } |
Explanation (EN)
An unexplained large z-index invites later arbitrary escalation.
Objašnjenje (HR)
Good example
New codecss
| 1 | .modal { |
| 2 | /* above sticky header (100) and ad parallax (2) */ |
| 3 | z-index: 200; |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
For a non-obvious stacking override, explain the intended relationship or use an established layer token, after inspecting the actual stacking contexts.
Exceptions / Tradeoffs (EN)
A clear design-system layer token may need no comment. Larger numbers cannot escape an ancestor stacking context, and a comment does not establish the computed ordering.