0

I'm fairly new to bootstrap and I have been having trouble re-ordering columns when re-sized in mobile.

So far this is what I have tried:

<div class="container">
<div class="row">
    <div class="col-lg-5 order-lg-1">
        B
    </div>
    <div class="col-lg-5">
      <div class="col-lg-12 order-lg-0">
        A
      </div>
      <div class="col-lg-12 order-lg-2">
        C
      </div>
   </div>
</div>
</div>

What I wanted to achieve is something like this: https://i.stack.imgur.com/9wPO6.jpg

And when I run my code and resized in mobile it turns out like this: B A C

Any help would be greatly appreciated! Thanks!

Ross V
  • 11
  • 3

2 Answers2

0

You can use Bootstrap Hidding Element option and also use Grid System to apply on mobile device col-sm* or col-xs* . Other option is to use Media Query to apply classes depending of the device width and height.

Example based on your code:

<div class="container">
    <div class="row">
        <div class="col-lg-6 col-md-6 order-md-2 order-lg-2 d-md-block d-sm-none d-xs-none d-none">
            B
        </div>
        <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
          <div class="col-lg-12 col-xs-12 col-sm-12 order-lg-1">
            A
          </div>
          <div class="col-lg-12 col-xs-12 col-sm-12 order-lg-2 d-block d-sm-none d-md-none">
            B
          </div>
          <div class="col-lg-12 col-xs-12 col-sm-12 order-lg-3">
            C
          </div>
       </div>
    </div>
</div>
Celioth
  • 18
  • 1
0

You can simply make the columns like this.

<div class="container">
  <div class="row">
    <div class="col-sm-6">
      <div class="col-sm-12">
        A
      </div>
      <div class="col-sm-12">
        C
      </div>
    </div>
    <div class="col-sm-6">
        B
    </div>
   </div>
</div>
Hiraeths
  • 380
  • 3
  • 16