Create three column layout using flex-box without stretching - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Column

Description

Create three column layout using flex-box without stretching

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">
.main-raw {<!--from   ww w  .java 2 s . c om-->
   width:651px;
   height:100%;
   display:-webkit-flex;
   display:flex;
   -webkit-justify-content:center;
   justify-content:center;
   -webkit-flex-direction:row;
   flex-direction:row;
   -webkit-flex-wrap:wrap;
   flex-wrap:wrap;
   -webkit-flex-flow:row wrap;
   flex-flow:row wrap;
   -webkit-align-content:flex-end;
   align-content:flex-end;
   border:3px solid Chartreuse;
}

.item {
   width:100px;
   margin:11px;
   background-color:yellow;
}

.item-1 {
   height:100px;
}

.item-2 {
   height:201px;
}

.item-3 {
   height:151px;
}

.item-4 {
   height:151px;
}

.item-5 {
   height:51px;
}

.item-6 {
   height:251px;
}
</style> 
 </head> 
 <body> 
  <div class="main-raw"> 
   <div class="first-row"> 
    <div class="item item-1">
      &nbsp; 
    </div> 
    <div class="item item-2">
      &nbsp; 
    </div> 
   </div> 
   <div class="second-row"> 
    <div class="item item-3">
      &nbsp; 
    </div> 
    <div class="item item-4">
      &nbsp; 
    </div> 
   </div> 
   <div class="third-row"> 
    <div class="item item-5">
      &nbsp; 
    </div> 
    <div class="item item-6">
      &nbsp; 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials