I have the following order in the desktop version:
<div class="row">
<div class="col-md-7">
Content 1
</div>
<div class="col-md-5">
Content 2
</div>
</div>
How can I make Content 2 appear first in mobile?
I have the following order in the desktop version:
<div class="row">
<div class="col-md-7">
Content 1
</div>
<div class="col-md-5">
Content 2
</div>
</div>
How can I make Content 2 appear first in mobile?
Use order-first
and orader-md-0
classes for the content 2
column.
order-first
orders the column first in the row. While order-md-0
resets the order
of the column when the md
breakpoint is reached.
There is no way to order the columns for mobile only because bootstrap has removed all the variants of *-xs-*
classes. Therefore, you need to use both of classes.
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.css" rel="stylesheet" />
<div class="row">
<div class="col-12 col-md-7">
Content 1
</div>
<div class="col-12 order-first order-md-0 col-md-5">
Content 2
</div>
</div>
You have not used col-*
for small size screen. So I used col-12
.
If you don't specifically have to use Bootstrap, then a simple flex layout will sort this.
There is a specific order
option: