"Change column order (column ordering) - Bootstrap 4"
Bootstrap 4.1.1 Snippet by ranjit1602

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <h2>Without column ordering</h2> <div class="row"> <div class="col-sm-6"> <img src="https://dummyimage.com/400x400/000/fff&text=A" alt="" class="w-100" /> </div> <div class="col-sm-6"> <img src="https://dummyimage.com/400x400/000/fff&text=B" alt="" class="w-100" /> </div> </div> <h2>With column ordering</h2> <div class="row"> <div class="col-sm-6 order-sm-12"> <img src="https://dummyimage.com/400x400/000/fff&text=B" alt="" class="w-100" /> </div> <div class="col-sm-6 order-sm-1"> <img src="https://dummyimage.com/400x400/000/fff&text=A" alt="" class="w-100" /> </div> </div> <h2>12 columns - Descending Order</h2> <div class="row"> <div class="col-sm-6 order-12"> <img src="https://dummyimage.com/400x400/000/fff&text=1" alt="" class="w-100" /> </div> <div class="col-sm-6 order-11"> <img src="https://dummyimage.com/400x400/000/fff&text=2" alt="" class="w-100" /> </div> <div class="col-sm-6 order-10"> <img src="https://dummyimage.com/400x400/000/fff&text=3" alt="" class="w-100" /> </div> <div class="col-sm-6 order-9"> <img src="https://dummyimage.com/400x400/000/fff&text=4" alt="" class="w-100" /> </div> <div class="col-sm-6 order-8"> <img src="https://dummyimage.com/400x400/000/fff&text=5" alt="" class="w-100" /> </div> <div class="col-sm-6 order-7"> <img src="https://dummyimage.com/400x400/000/fff&text=6" alt="" class="w-100" /> </div> <div class="col-sm-6 order-6"> <img src="https://dummyimage.com/400x400/000/fff&text=7" alt="" class="w-100" /> </div> <div class="col-sm-6 order-5"> <img src="https://dummyimage.com/400x400/000/fff&text=8" alt="" class="w-100" /> </div> <div class="col-sm-6 order-4"> <img src="https://dummyimage.com/400x400/000/fff&text=9" alt="" class="w-100" /> </div> <div class="col-sm-6 order-3"> <img src="https://dummyimage.com/400x400/000/fff&text=10" alt="" class="w-100" /> </div> <div class="col-sm-6 order-2"> <img src="https://dummyimage.com/400x400/000/fff&text=11" alt="" class="w-100" /> </div> <div class="col-sm-6 order-1"> <img src="https://dummyimage.com/400x400/000/fff&text=12" alt="" class="w-100" /> </div> </div> <h2>12 columns - Ascending Order</h2> <div class="row"> <div class="col-sm-6"> <img src="https://dummyimage.com/400x400/000/fff&text=1" alt="" class="w-100" /> </div> <div class="col-sm-6"> <img src="https://dummyimage.com/400x400/000/fff&text=2" alt="" class="w-100" /> </div> <div class="col-sm-6"> <img src="https://dummyimage.com/400x400/000/fff&text=3" alt="" class="w-100" /> </div> <div class="col-sm-6"> <img src="https://dummyimage.com/400x400/000/fff&text=4" alt="" class="w-100" /> </div> <div class="col-sm-6"> <img src="https://dummyimage.com/400x400/000/fff&text=5" alt="" class="w-100" /> </div> <div class="col-sm-6"> <img src="https://dummyimage.com/400x400/000/fff&text=6" alt="" class="w-100" /> </div> <div class="col-sm-6"> <img src="https://dummyimage.com/400x400/000/fff&text=7" alt="" class="w-100" /> </div> <div class="col-sm-6"> <img src="https://dummyimage.com/400x400/000/fff&text=8" alt="" class="w-100" /> </div> <div class="col-sm-6"> <img src="https://dummyimage.com/400x400/000/fff&text=9" alt="" class="w-100" /> </div> <div class="col-sm-6"> <img src="https://dummyimage.com/400x400/000/fff&text=10" alt="" class="w-100" /> </div> <div class="col-sm-6"> <img src="https://dummyimage.com/400x400/000/fff&text=11" alt="" class="w-100" /> </div> <div class="col-sm-6"> <img src="https://dummyimage.com/400x400/000/fff&text=12" alt="" class="w-100" /> </div> </div> </div>
h2 {margin-top:2em;} .container { padding:2rem; } .order-sm-12 img { border:5px solid orange; } .order-sm-1 img { border:5px solid blue; }

Related: See More


Questions / Comments: