CSS dynamic grid positioning various heights - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

CSS dynamic grid positioning various heights

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">
.img-grid .img-grid-item-holder {
   float:left;
   width:26%;
   overflow:hidden;
   padding:0px;
   margin:0px;
}

.img-grid img {
   width:100% !important;
   height:auto !important;
}
</style> <!--from w  ww . j a v  a  2  s . com-->
 </head> 
 <body> 
  <div class="img-grid"> 
   <div class="img-grid-item-holder"> 
    <img src="https://www.java2s.com/style/demo/InternetExplorer.png"> 
   </div> 
   <div class="img-grid-item-holder"> 
    <img src="https://www.java2s.com/style/demo/Safari.png"> 
   </div> 
   <div class="img-grid-item-holder"> 
    <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> 
   </div> 
   <div class="img-grid-item-holder"> 
    <img src="https://www.java2s.com/style/demo/Safari.png"> 
   </div> 
   <div class="img-grid-item-holder"> 
    <img src="https://www.java2s.com/style/demo/Opera.png"> 
   </div> 
   <div class="img-grid-item-holder"> 
    <img src="https://www.java2s.com/style/demo/Opera.png"> 
   </div> 
   <div class="img-grid-item-holder"> 
    <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials