Table layout via a flexbox with wrapped children - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Wrap

Description

Table layout via a flexbox with wrapped children

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 > div {
   display: flex;
   width: 34rem;
   justify-content: space-between;<!--from  ww w . j  a va 2 s  .co m-->
   border: 1px solid black;
}
body > div > div {
   display: flex;
   flex-flow: row wrap;
}
body > div > div.red {
   background: rgba(255, 0, 0, .1);
   max-width: 345px;
}
body > div > div.green {
   background: rgba(0, 255, 0, .1);
   flex-shrink: 0;
}
body > div > div > div {
   margin: 1rem;
   height: 5rem;
   width: 5rem;
   background: rgba(0, 0, 0, .1);
}


      </style> 
 </head> 
 <body> 
  <div> 
   <div class="red"> 
    <div></div> 
    <div></div> 
    <div></div> 
    <div></div> 
    <div></div> 
   </div> 
   <div class="green"> 
    <div></div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials