Reorder column for small devices in responsive design - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Column Layout

Description

Reorder column for small devices in responsive design

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <title>  Anton</title> 
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> 
  <style>

.col {<!--   www . ja v  a  2 s .  co m-->
   display: flex;
}
.col .block {
   background: #ff6347;
   color: #fff;
   width: 100px;
   height: 100px;
   margin: 10px;
   border: 3px solid #8b0000;
}
@media screen and (max-width: 800px) {
   .col {
      flex-flow: column nowrap;
   }
   .col .swap {
      order: 1;
   }
}


      </style> 
 </head> 
 <body translate="no"> 
  <div class="col"> 
   <div class="block">
     A 
   </div> 
   <div class="block">
     B 
   </div> 
  </div> 
  <div class="col"> 
   <div class="block swap">
     C 
   </div> 
   <div class="block">
     D 
   </div> 
  </div> 
  <div class="col"> 
   <div class="block">
     E 
   </div> 
   <div class="block">
     F 
   </div> 
  </div> 
  <div class="col"> 
   <div class="block swap">
     G 
   </div> 
   <div class="block">
     H 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials