Revamping in Bootstrap 5 for 2021
The new responsive ordering classes have been introduced as order-first
, order-last
, and from order-0
to order-5
Check out the Demo here
Back in 2018 with Bootstrap 4
The responsive ordering classes were order-first
, order-last
and ranged from order-0
to order-12
The **push** and **pull** classes in Bootstrap 4 are now labelled as `push-{viewport}-{units}` and `pull-{viewport}-{units}`, without the `xs-` prefix. To achieve a 1-3-2 layout on mobile/xs, utilize this [demo for Bootstrap 4 push and pull](http://www.codeply.com/go/OmrcmepbUp) (Note: this functionality is pre-4.0 beta only)
Bootstrap 4.1+
With Bootstrap 4 employing flexbox, altering the column order is straightforward. Columns can be ordered from order-1
to order-12
, responsively as demonstrated in order-md-12 order-2
(appearing last on md
, and second on xs
) in relation to the parent .row
.
<div class="container">
<div class="row">
<div class="col-3 col-md-6">
<div class="card card-body">1</div>
</div>
<div class="col-6 col-md-12 order-2 order-md-12">
<div class="card card-body">3</div>
</div>
<div class="col-3 col-md-6 order-3">
<div class="card card-body">2</div>
</div>
</div>
</div>
See the live Demo: Implementing order-*
classes to reorder
Desktop view (larger screens):
https://i.sstatic.net/M53x9.png
Mobile view (smaller screens):
https://i.sstatic.net/q0A5m.png
You can also adjust column order using the flexbox direction utilities...
<div class="container">
<div class="row flex-column-reverse flex-md-row">
<div class="col-md-8">
2
</div>
<div class="col-md-4">
1st on mobile
</div>
</div>
</div>
View the Demo: Flexbox Direction for Ordering in Bootstrap 4.1
Demos of older versions
demo - alpha 6
demo - beta (3)
Explore more Bootstrap 4.1+ ordering demos
Related
Column ordering in Bootstrap 4 with push/pull and col-md-12
Bootstrap 4 change order of columns
A-C-B A-B-C