Performance: Row spanning
MEDIUM IMPACT
Row spanning affects layout calculation and paint performance by changing how grid items occupy multiple rows, impacting browser reflows and rendering.
<div class="grid grid-cols-3" style="grid-auto-rows: 6rem;"> <div class="row-span-3">Item 1</div> <div>Item 2</div> <div>Item 3</div> <div>Item 4</div> </div>
<div class="grid grid-cols-3"> <div class="row-span-3">Item 1</div> <div>Item 2</div> <div>Item 3</div> <div>Item 4</div> </div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Row span without fixed row height | Minimal DOM nodes | Multiple reflows due to dynamic height | Higher paint cost from layout shifts | [X] Bad |
| Row span with fixed grid-auto-rows height | Minimal DOM nodes | Single reflow with stable layout | Lower paint cost with no layout shifts | [OK] Good |