Performance: Grid item placement
MEDIUM IMPACT
Grid item placement affects how the browser calculates layout and paints grid items, impacting rendering speed and visual stability.
grid-template-columns: repeat(3, 1fr); .grid-item1 { grid-column: 1 / 2; grid-row: 1 / 2; } .grid-item2 { grid-column: 2 / 3; grid-row: 1 / 2; }
grid-template-columns: repeat(3, 1fr); .grid-item { grid-column-start: auto; grid-row-start: auto; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Implicit auto-placement | Standard DOM nodes | Multiple reflows if items shift | Moderate paint cost due to layout shifts | [X] Bad |
| Explicit grid line placement | Standard DOM nodes | Single reflow | Lower paint cost with stable layout | [OK] Good |