Search code examples
twitter-bootstraptwitter-bootstrap-3multiple-columnsgrid-layoutmultirow

Pushing a column to another row


So here's what I have in a LG design.

    +-----+-----+
    |  A  |  B  |
    +-----+-----+
    |  C  |  D  |
    +-----+-----+

I want to reorder it in a MD design to look like this:

    +---------+---------+
    |         A         |
    +---------+---------+
    | C   |   D  |  B   |
    +-------------------+

Is there a way for me to push "B" from the first row to the second, in that position? :)


Solution

  • Try something like this:

    .row div {
      border: 1px solid black;
      }
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
    
    <div class="container">
      <div class="row">
        <div class="col-lg-6 col-md-12">A</div>
        <div class="col-lg-6 col-md-4 col-md-push-8 col-lg-push-0">B</div>
        <div class="col-lg-6 col-md-4 col-md-pull-4 col-lg-pull-0">C</div>
        <div class="col-lg-6 col-md-4 col-md-pull-4 col-lg-pull-0">D</div>
      </div>
    </div>

    By adding the class col-md-12 to the column A, it will take up the whole row and column B will flow to the next row. However, it will appear on the left side. If you want it to appear on the right side, you have to specifiy the col-*-pull-* and col-*-push-* classes.