Performance: Masonry-style grid
MEDIUM IMPACT
This affects page load speed and rendering performance by how the browser calculates layout and paints items in a masonry grid.
<div class="columns-3 gap-4">
<!-- Items with varying heights -->
</div><div class="grid grid-cols-3 gap-4"> <!-- Items with varying heights --> </div> <script> // JavaScript to reorder items for masonry effect const container = document.querySelector('div'); // complex JS layout logic </script>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| JavaScript masonry layout | High (DOM reorder) | Multiple per item | High (many repaints) | [X] Bad |
| CSS columns masonry | Low (no reorder) | Single layout pass | Low (native paint) | [OK] Good |