Performance: Nested elements
MEDIUM IMPACT
Nested elements affect the browser's layout and paint performance by increasing DOM complexity and rendering work.
<section><p>Content</p></section>
<div><div><div><div><div><p>Content</p></div></div></div></div></div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Deeply nested elements | High DOM depth and many nodes | Multiple reflows triggered | High paint cost due to many layers | [X] Bad |
| Flat structure with minimal nesting | Low DOM depth and fewer nodes | Single reflow | Low paint cost | [OK] Good |