Create three column layout with inner item aligned to top - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:3 Column

Description

Create three column layout with inner item aligned 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">
.gallery {<!--from  ww w.j av  a2  s .c  o  m-->
   width:100%;
   height:100%;
   background-color:Chartreuse;
}

.galleryBlock {
   position:relative;
   width:501px;
   height:100%;
   margin-left:auto;
   margin-right:auto;
   display:-webkit-flex;
   background-color:yellow;
}

.galleryTile {
   height:121px;
   margin:6px;
   float:left;
   -webkit-flex:2;
}

img {
   width:100%;
   height:100%;
}
</style> 
 </head> 
 <body> 
  <div class="gallery"> 
   <div class="galleryBlock"> 
    <div class="galleryTile"> 
     <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> 
    </div> 
    <div class="galleryTile"> 
     <img src="https://www.java2s.com/style/demo/Opera.png"> 
    </div> 
    <div class="galleryTile"> 
     <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> 
    </div> 
    <div class="galleryTile"> 
     <img src="https://www.java2s.com/style/demo/Opera.png"> 
    </div> 
    <div class="galleryTile"> 
     <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> 
    </div> 
    <div class="galleryTile"> 
     <img src="https://www.java2s.com/style/demo/Safari.png"> 
    </div> 
    <div class="galleryTile"> 
     <img src="https://www.java2s.com/style/demo/Opera.png"> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials