Performance: Overflow handling
MEDIUM IMPACT
Controls how content that exceeds container size is displayed, impacting layout stability and rendering speed.
<div class="w-64 h-32 overflow-auto"> <p class="whitespace-normal">Very long text that overflows but is scrollable inside the container, preventing layout shifts.</p> </div>
<div class="w-64 h-32"> <p class="whitespace-normal">Very long text that overflows the container without any overflow control, causing layout shifts.</p> </div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No overflow control (content spills) | High (container resizes) | Multiple reflows on content change | High paint cost due to layout shifts | [X] Bad |
| Overflow-auto with scrollbars | Low (fixed container size) | Single reflow | Lower paint cost, stable layout | [OK] Good |
| Overflow-hidden clipping content | Low (fixed container size) | Single reflow | Low paint cost, no layout shifts | [OK] Good |