Performance: List use cases in layout
MEDIUM IMPACT
Using lists in layout affects DOM size and rendering speed, impacting page load and visual stability.
<nav><ul><li><a href="#">Home</a></li><li><a href="#">About</a></li><li><a href="#">Contact</a></li></ul></nav>
<div><div>Home</div><div>About</div><div>Contact</div></div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Flat semantic list with specified image sizes | Low (few nodes, shallow depth) | Minimal (single layout pass) | Low (simple paint) | [OK] Good |
| Deeply nested lists without size attributes | High (many nodes, deep nesting) | Multiple reflows (layout thrashing) | High (complex paint) | [X] Bad |
| Using divs instead of lists for menus | Medium (extra nodes for styling) | Extra style recalculations | Medium (complex paint) | [!] OK |