Performance: Negative margin usage
MEDIUM IMPACT
Negative margins affect layout calculation and can cause layout shifts impacting visual stability.
<div class="-m-2">...</div><div class="-m-10">...</div>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Large negative margin (-m-10) | No extra DOM nodes | Multiple reflows due to layout shifts | High paint cost from overlapping elements | [X] Bad |
| Small negative margin (-m-2) | No extra DOM nodes | Single or no reflow, stable layout | Low paint cost, no overlap | [OK] Good |