Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Reorder Columns with Bootstrap 4?

I have used the following tags in bootstrap 4 .

    <div class="container">
        <div class="row align-items-center">
            <div class="col-md-3">
                <div class="right-user-account" >
                    <a href="#">User Account</a>
                </div>
            </div>

            <div class="col-md-6">
                <img src="images/logo.png">
            </div>

            <div class="col-md-3">
                <div class="left-login" >
                    <a href="#">Login</a>
                </div>
            </div>
        </div>
    </div>

enter image description here

I want to be in full-width with the logo

enter image description here

How do I work with the reorder command?

like image 436
Mostafa Norzade Avatar asked Jan 13 '18 08:01

Mostafa Norzade


People also ask

How do I reorder columns in Bootstrap 4 order?

Since Bootstrap 4 is flexbox, it's easy to change the order of columns. The cols can be ordered from order-1 to order-12 , responsively such as order-md-12 order-2 (last on md , 2nd on xs ) relative to the parent . row . It's also possible to change column order using the flexbox direction utils...

How do I change the order of columns in Bootstrap?

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 change the order of elements in Bootstrap?

You can order the elements using a flex container. The outer div is set to "display: flex;" and the inside elements get given an order. By giving element B an order of 1, and element A an order 2. Element B will be placed before A even though A is first in the code.

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

Try using col-lg-push and col-lg-pull to reorder the columns in large screens and display the sidebar on the left and main content on the right.


2 Answers

Bootstrap 4 uses flex/flexbox. So yes you have the option of ordering elements/columns.

I think what you want is using just the Bootstrap-4 classes of order-{number} with your col classes.

Below is the solution:

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
  <div class="row align-items-center">
  
    <div class="col-md-3 col order-2 order-sm-1">
      <div class="right-user-account">
        <a class="fd-head-login" href="#">
          <i class="fa fa-caret-down"></i>User Account</a>
      </div>
    </div>
    
    <div class="col-md-6 text-center col-md-6 order-1 order-sm-2">
      <a href="#">
        <img src="images/logo.png">
      </a>
    </div>

    <div class="col-md-3 order-3">
      <div class="left-login">
        <a class="fd-head-login" href="#">Login<i class="fa fa-user"></i></a>
      </div>
    </div>
    
  </div>
</div>

You can find more here.

Codepen link to playaround screen widths

Hope this answer helps you!

like image 121
divy3993 Avatar answered Oct 17 '22 02:10

divy3993


You can use reordering option of bootstrap
https://getbootstrap.com/docs/4.0/layout/grid/#reordering

like image 39
Saeed Avatar answered Oct 17 '22 03:10

Saeed