Performance: Column ordering
MEDIUM IMPACT
This affects the browser's layout and paint phases by changing the visual order of columns without altering the DOM structure.
<div class="row"> <div class="col order-2">First</div> <div class="col order-3">Second</div> <div class="col order-1">Third</div> </div>
<div class="row"> <div class="col">First</div> <div class="col">Second</div> <div class="col">Third</div> </div> <!-- To reorder, developer changes HTML order --> <div class="row"> <div class="col">Third</div> <div class="col">First</div> <div class="col">Second</div> </div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Changing HTML order | Modifies DOM nodes order | Multiple reflows | High paint cost due to layout shifts | [X] Bad |
| Using Bootstrap order classes | No DOM changes | Single reflow | Lower paint cost, stable layout | [OK] Good |