Create Flex Box with 3 column and align to top - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Flex Column

Description

Create Flex Box with 3 column and align to top

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">
.categories {<!--from ww w.j a v a  2  s  .co  m-->
   display:flex;
   flex-wrap:wrap;
}

.categories .category {
   width:34.34%;
   display:flex;
   flex-direction:column;
}

.category>ul {
   margin:0;
   box-sizing:border-box;
}

.red {
   background-color:Chartreuse;
}

.purple {
   background-color:yellow;
}
</style> 
 </head> 
 <body> 
  <div class="categories"> 
   <div class="category"> 
    <ul class="purple"> 
     <li> <span>Heading</span> 
      <ul> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
      </ul> </li> 
    </ul> 
    <ul class="red"> 
     <li> <span>Heading 4</span> 
      <ul> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
      </ul> </li> 
    </ul> 
   </div> 
   <div class="category"> 
    <ul> 
     <li> <span>Heading</span> 
      <ul> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
      </ul> </li> 
    </ul> 
    <ul> 
     <li> <span>Heading</span> 
      <ul> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
      </ul> </li> 
    </ul> 
   </div> 
   <div class="category"> 
    <ul> 
     <li> <span>Heading</span> 
      <ul> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
       <li>sub-heading</li> 
      </ul> </li> 
    </ul> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials