1.

Column Ordering in Bootstrap?

Answer»

With Bootstrap, you can easily order columns with PUSH and pull i.e. change the order of built-in grid columns. Use the .col-md-push-* and .col-md-pull-* classes to change the order of columns. Here, * range from 1 to 12.

Let us SEE an example wherein we have ordered columns:

<!DOCTYPE html> <html lang="en"> <head>   <title>Bootstrap Example</title>   <meta charset="utf-8">   <meta name="viewport" content="width=device-width, initial-scale=1">   <link rel="stylesheet" HREF="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <body> <div class="container-fluid">   <h1>Column Ordering</h1>   <p><strong>Note: </strong>Resize the web BROWSER to see the effect.</p>   <h2>Before ordering columns</h2>   <div class="row">     <div class="col-sm-4" style="background-color:blue;color: white;">Demo</div>     <div class="col-sm-8" style="background-color:orange;color: white;">Demo</div>   </div>   <h2>After ordering columns</h2>   <div class="row">     <div class="col-sm-4 col-sm-push-8" style="background-color:blue;color: white;">Demo</div>     <div class="col-sm-8 col-sm-pull-4" style="background-color:orange;color: white;">Demo</div>   </div> </div> </body> </html>

In the above web page, we have SHOWN what happens when we order columns using the push and pull classes.

Let us now see the output. Resize the browser window to get the following that displays the columns ordered successfully:



Discussion

No Comment Found