To achieve this layout, utilize the pull and push responsive helper classes.
When working with Bootstrap 3, which prioritizes mobile responsiveness, always begin designing for the smallest view. Ensure that the order of your columns in the HTML matches the desired sequence for the smallest view: B, A, and C. Assign a size of .col-xs-12
for B and .col-xs-6
for both A and C. Your minimal layout will be well-configured at this point.
For larger layouts, particularly using md, start by allocating fixed column sizes. Since A, B, and C should share the same row totaling 12 columns, set .col-md-6
for B and .col-md-3
for both A and C. Although the column widths are correct, the positions of A and B need adjustment.
To reorder these columns, move A six columns to the left with .col-md-pull-6
and shift B three columns to the right using .col-md-push-3
.
.box {
background-color: #f99;
border: 1px solid #c66;
text-align: center;
}
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row">
<div class="col-xs-12 col-md-6 col-md-push-3"><div class="box">B</div></div>
<div class="col-xs-6 col-md-3 col-md-pull-6"><div class="box">A</div></div>
<div class="col-xs-6 col-md-3"><div class="box">C</div></div>
</div>
</div>
P.S. While this method effectively arranges responsive layouts with varying column orders, it may encounter challenges when pushing or pulling columns to different rows. The push and pull classes adjust the position of an element as long as it has a position: relative
property, preventing it from wrapping to another row. If necessary, consider duplicating the column and its content while utilizing classes like visible-xs-block
to display them appropriately.