Flexbox grid with multiple size flex items - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex

Description

Flexbox grid with multiple size flex items

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">
flex-container {<!--  w w  w .jav  a  2  s. c o m-->
   display:flex;
}

flex-item {
   flex-grow:2;
   height:201px;
   margin:0 6px;
   display:flex;
   flex-direction:column;
}

.big {
   flex:0 0 41%;
   background-color:Chartreuse;
}

div {
   flex-grow:2;
   background-color:yellow;
}

div + div {
   margin-top:11px;
}
</style> 
 </head> 
 <body> 
  <flex-container> 
   <flex-item> 
    <div></div> 
    <div></div> 
   </flex-item> 
   <flex-item class="big"></flex-item> 
   <flex-item> 
    <div></div> 
    <div></div> 
   </flex-item> 
  </flex-container> 
  <br> 
  <hr> 
  <br> 
  <flex-container> 
   <flex-item class="big"></flex-item> 
   <flex-item> 
    <div></div> 
    <div></div> 
   </flex-item> 
   <flex-item> 
    <div></div> 
    <div></div> 
   </flex-item> 
  </flex-container>  
 </body>
</html>

Related Tutorials