Bootstrap right Column on top on mobile view

前端 未结 11 2106
逝去的感伤
逝去的感伤 2020-11-28 17:51

I have a Bootstrap Page like this:

A
相关标签:
11条回答
  • 2020-11-28 18:34

    This worked for me on Bootstrap 4:

    <div class="container-fluid">
      <div class="row">
        <div class="col-md-4 order-md-last">
          <%= render 'form'%>
        </div>
        <div class="col-md-8 order-md-first">
          CONTENT
        </div>
      </div>
    </div>
    
    0 讨论(0)
  • 2020-11-28 18:38

    The below code work for me

    .row {
        display: flex;
        flex-direction: column-reverse;
    }
    
    0 讨论(0)
  • 2020-11-28 18:39

    This is now done (in Bootstrap v4) by adding order-# classes.

    See https://getbootstrap.com/docs/4.1/migration/#grid-system-1

    Like this:

    <div classname='col-md-8 order-2'>...</div>
    <div classname='col-md-4 order-1'>...</div>
    
    0 讨论(0)
  • 2020-11-28 18:41

    It's worth noting that if you are using columns that are not both equal to 6, then the push amount will not equal the initial column size.

    If you have 2 columns (A & B) and wish for column A to be smaller and to the right on "sm" or greater viewports, but atop a mobile (xs) viewport, you would use the following:

    <div class="row">
        <div class="col-sm-4 col-sm-push-8">A</div>
        <div class="col-sm-8 col-sm-pull-4">B</div>
    </div>
    

    Otherwise, the alignment of the columns will appear off.

    0 讨论(0)
  • 2020-11-28 18:41

    Flexbox Direction

    For Bootstrap 4, apply one of the following to your .row div:

    .flex-row-reverse
    

    For responsive settings:

    .flex-sm-row-reverse
    .flex-md-row-reverse
    .flex-lg-row-reverse
    .flex-xl-row-reverse
    
    0 讨论(0)
提交回复
热议问题