Performance: Column stacking on mobile
This affects the page's layout rendering speed and visual stability on mobile devices.
<div class="row"> <div class="col-12 col-md-6">Column 1</div> <div class="col-12 col-md-6">Column 2</div> </div>
<div class="row"> <div class="col-6">Column 1</div> <div class="col-6">Column 2</div> </div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Fixed columns without responsive classes | Minimal DOM nodes | Multiple reflows on resize due to forced horizontal scroll | Higher paint cost from layout shifts | [X] Bad |
| Responsive columns with col-12 col-md-6 classes | Minimal DOM nodes | Single reflow on resize with smooth stacking | Lower paint cost with stable layout | [OK] Good |
col-12 do on mobile screens?col-12 meaningcol-12 means the column will take all 12 parts of the grid, which is full width.col-12 stack vertically because each takes full width.col-12 = full width stack [OK]col-12 makes columns full width on mobile, so they stack vertically.col-md-6 makes columns half width on medium screens, so they sit side-by-side.col-12 col-md-6 -> Option D<div class='row'> <div class='col-12 col-md-4'>A</div> <div class='col-12 col-md-8'>B</div> </div>
col-12 which means full width on small screens, so they stack vertically.col-md-4 and col-md-8 apply only on medium and larger screens, so no effect on mobile.<div class='row'> <div class='col-md-6'>Left</div> <div class='col-md-6'>Right</div> </div>
col-* classes for small screens, columns try to share space equally side-by-side.col-12 for mobile stackingcol-12 makes columns full width on mobile, forcing vertical stacking.col-12 to make columns full width on mobile -> Option Bcol-12 makes columns full width on mobile, so they stack vertically.col-md-6 means on medium screens (tablets), columns take half width, so two fit side-by-side.col-lg-4 means on large screens (desktops), columns take 4/12 width, so three fit side-by-side.col-12 col-md-6 col-lg-4 -> Option CPass the test and this pattern moves unknown