Rules Hub
Code Ruleset
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Keep z-index values low and lean on DOM order for stacking
Don't escalate z-index (9999) to win stacking battles. Among equal z-index, later DOM elements stack on top, so reorder markup or use small values; keep a handful of defined layers.
Bad example
| 1 | .popover { z-index: 9999999999; } |
Explanation (EN)
Arbitrarily escalating a number does not explain or necessarily fix the stacking relationship.
Objašnjenje (HR)
Good example
| 1 | .popover { z-index: 10; } /* and rely on DOM order / a small layer scale */ |
Explanation (EN)
Objašnjenje (HR)
Notes (EN)
Use a small established layer scale after identifying actual stacking contexts and paint order. Reorder DOM only when semantic reading/focus order remains correct.
Exceptions / Tradeoffs (EN)
Later DOM order only settles comparable painting categories within the relevant context. A high child z-index cannot escape a lower ancestor stacking context.