Relayout 3 divs based on screen size - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:3 Column

Description

Relayout 3 divs based on screen size

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
body, html {
   height:100%;
}

.container {<!--from  w ww.ja  v a 2s.com-->
   display:flex;
   flex-flow:column wrap;
   height:100%;
}

.a, .b {
   flex:2 0 51%;
}

.c {
   flex:3 0 51%;
}

.a {
   background:yellow;
}

.b {
   background:orange;
}

.c {
   background:grey;
}

@media (max-width: 20em)  {
   .a, .b, .c {
      flex:2 2 auto;
   }
   
   .b {
      order:2;
   }

}
</style> 
 </head> 
 <body> 
  <section class="container"> 
   <div class="a">
     a 
   </div> 
   <div class="b">
     b 
   </div> 
   <div class="c">
     c 
   </div> 
  </section>  
 </body>
</html>

Related Tutorials