Performance: Hidden, scroll, auto
MEDIUM IMPACT
These CSS overflow properties affect how content overflow is handled, impacting layout stability and rendering performance.
div {
overflow: scroll;
height: 200px;
}div {
overflow: auto;
height: 200px;
}| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| overflow: auto | Minimal DOM changes | Reflow triggered when scrollbar appears/disappears | Medium paint cost due to scrollbar rendering | [!] OK |
| overflow: scroll | Minimal DOM changes | Single reflow on initial layout | Consistent paint cost, no layout shifts | [OK] Good |
| overflow: hidden | Minimal DOM changes | No reflows from scrollbar changes | Lower paint cost by clipping overflow | [OK] Good |
| overflow: visible | Minimal DOM changes | No scrollbar reflows but possible layout shifts | Higher paint cost due to overflow content | [X] Bad |