Performance: Common layering issues
MEDIUM IMPACT
This affects visual stability and interaction responsiveness by causing unexpected element overlaps and repaints.
/* Use minimal and logical z-index values with clear stacking order */ .header { position: relative; z-index: 1; } .modal { position: fixed; z-index: 10; } .tooltip { position: absolute; z-index: 20; }
/* Multiple elements with high z-index values creating complex stacking contexts */ .header { position: relative; z-index: 1000; } .modal { position: fixed; z-index: 2000; } .tooltip { position: absolute; z-index: 3000; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| High scattered z-index values | No extra DOM nodes | 0 reflows | Multiple paints and repaints due to complex stacking | [X] Bad |
| Minimal logical z-index values | No extra DOM nodes | 0 reflows | Single paint with simple compositing | [OK] Good |