Reorder Columns in Mobile Screen using Bootstrap

Last Reply on Sep 01, 2015 04:44 AM By aditya2267

Posted on Aug 24, 2015 02:51 AM

Hi,

There are 5 equal clolumns in bootstrap.

<div class="row">
<div class="col-md-2"> box 1 </div>
<div class="col-md-3">box 2</div>
<div class="col-md-2">box 3 </div>
<div class="col-md-2">box 4</div>
<div class="col-md-3">box 5</div>
</div>

I want to reorder these columns in small screen (mobile devices) like below picture.

regards firoz

Posted on Sep 01, 2015 04:44 AM

Please Refer below code.

<!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="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  <style type="text/css">
       .box { background-color:#38B3DF; text-align:center; color:#fff; margin-bottom:10px; }
  </style>
</head>
 
<body>
<div class="row">
<div class="col-md-2 col-xs-6"><div class="box"> box 1 </div></div>
<div class="col-md-3 col-xs-6"><div class="box"> box 2 </div></div>
<div class="col-md-2 col-xs-6"><div class="box"> box 3 </div></div>
<div class="col-md-2 col-xs-6"><div class="box"> box 4 </div></div>
<div class="col-md-3 col-xs-12"><div class="box"> box 5 </div></div>
</div>
</body>
</html>

Demo

Thanks