Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Order and stack 3 columns with bootstrap 4

I have this structure in bootstrap columns: enter image description here

And I want you to change to a lower resolution, be ordered as follows:enter image description here

I found how to do it with flexbox here: Flexbox: reorder and stack columns

But I can not change the entire structure of my project to flexbox, so I want to know if with bootstrap 4, it is possible to do so.

Thank you very much.

My poor test.

@import url( 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css' );

div {
  text-align: center;
  height: 60px;
}

#left {
  background: yellow;
}

#middle {
  background: blue;
}

#right {
  background: coral;
}
<div class="container">
  <div class="row">
    <div class="col-sm-3 col-md-3">
      <div id="left">COLUMN 1</div>
    </div>
    <div class="col-sm-6 col-md-6">
      <div id="middle">COLUMN 2</div>
    </div>
    <div class="col-sm-3 col-md-3">
      <div id="right">COLUMN 3</div>
    </div>
  </div>
</div>
like image 246
Alorse Avatar asked Mar 09 '17 21:03

Alorse


People also ask

How do I make 3 columns in Bootstrap 4?

Three Equal ColumnsUse the . col class on a specified number of elements and Bootstrap will recognize how many elements there are (and create equal-width columns). In the example below, we use three col elements, which gets a width of 33.33% each.

How do I change the order of columns in Bootstrap 4?

We can easily change the order of built-in grid columns with push and pull column classes. The Push and Pull Classes: The push class will move columns to the right while the pull class will move columns to the left.

How do I make 5 columns in Bootstrap 4?

Populate the 'row' div with 5 divs with class 'col'. Because Bootstrap 4.0+ grid system has now shifted to Flexbox, the columns will arrange by themselves into five equally sized DOM elements.

How do I make 4 columns in Bootstrap?

First example: create a row ( <div class="row"> ). Then, add the desired number of columns (tags with appropriate . col-*-* classes). The first star (*) represents the responsiveness: sm, md, lg or xl, while the second star represents a number, which should always add up to 12 for each row.


1 Answers

You can use the Bootstrap 4 (alpha 6) utility classes to avoid the extra CSS. 1-2-3 becomes 3-2-1 on mobile.

<div class="container">
    <div class="row">
        <div class="col-sm-8 col-md-6 push-md-3">
          <div id="middle">COLUMN 2</div>
        </div>
        <div class="col-sm-4 col-md-6">
          <div class="row">
            <div class="col-md-6 pull-md-12 flex-last flex-md-unordered">
             <div id="left">COLUMN 1</div>
           </div>
            <div class="col-md-6">
             <div id="right">COLUMN 3</div>
           </div>
          </div>
        </div>
    </div>
</div>

http://codeply.com/go/GIcPuzURbs

like image 142
Zim Avatar answered Oct 18 '22 14:10

Zim