Performance: Grid container activation
MEDIUM IMPACT
Activating a grid container affects the browser's layout and paint phases by creating a new formatting context and triggering layout calculations for grid items.
<div class="grid grid-cols-3 gap-4"> <div>Item 1</div> <div>Item 2</div> <div>Item 3</div> </div>
<div class="flex flex-wrap"> <div class="w-1/3">Item 1</div> <div class="w-1/3">Item 2</div> <div class="w-1/3">Item 3</div> </div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Flex wrap with fixed widths | Moderate | Multiple on resize | Medium | [X] Bad |
| Grid container with fixed columns | Moderate | Single on resize | Medium | [OK] Good |