Performance: Sidebar with main content
MEDIUM IMPACT
This affects page load speed and rendering performance by how the sidebar and main content are structured and styled, impacting layout calculations and paint times.
<div class="grid grid-cols-[250px_1fr] min-h-screen"> <aside class="bg-gray-200">Sidebar</aside> <main class="p-4">Main content</main> </div>
<div class="sidebar" style="width: 250px; float: left;">Sidebar</div> <div class="main" style="margin-left: 250px;">Main content</div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Float sidebar with margin main | Low (2 nodes) | Multiple reflows on resize | Medium paint cost | [X] Bad |
| CSS Grid sidebar with main | Low (2 nodes) | Single reflow on resize | Low paint cost | [OK] Good |