Performance: Responsive card grid
MEDIUM IMPACT
This affects page load speed and rendering performance by controlling how many cards are shown per row and how the layout adapts to screen size.
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4"> <div class="p-4">Card 1</div> <div class="p-4">Card 2</div> <div class="p-4">Card 3</div> <div class="p-4">Card 4</div> </div>
<div class="flex flex-wrap"> <div class="w-1/3 p-4">Card 1</div> <div class="w-1/3 p-4">Card 2</div> <div class="w-1/3 p-4">Card 3</div> <div class="w-1/3 p-4">Card 4</div> </div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Flex-wrap with fixed widths | Low | Multiple on resize | Medium | [X] Bad |
| CSS Grid with responsive columns | Low | Single per breakpoint | Low | [OK] Good |