Making responsive multiple divs - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Making responsive multiple divs

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">
#wrapper {<!--   ww w .  ja v a  2 s. c  om-->
   margin:0 auto;
   max-width:961px;
}

#main-content {
   background:Chartreuse;
   padding:8px;
   width:100%;
   min-height:401px;
   box-sizing:border-box;
}

.img-item {
   padding:16px 16px;
   width:51%;
   margin:11px 0;
   float:left;
   box-sizing:border-box;
   position:relative;
}

.images {
   width:100%;
   position:relative;
   z-index:51;
}

#img-row>a {
   position:relative;
}

#img-row {
   overflow:hidden;
}

#img-row:after {
   content:"";
   position:absolute;
   display:block;
   left:0;
   top:0;
   width:100%;
   height:100%;
   z-index:2;
}

.button {
   display:block;
   background-color:yellow;
   margin:11px;
}

button.button {
   width:251px;
   margin:26px auto;
   height:41px;
   font-size:31px;
}

.wp-caption-text {
   display:block;
   position:absolute;
   width:100%;
   color:blue;
   top:51%;
   left:0;
   right:0;
   text-align:center;
   font-weight:701;
   z-index:201;
   font-size:41px;
   transform:translateY(-51%)
}

@media screen and (max-width: 767px)  {
   .img-item {
      padding:8px;
      width:100%;
   }

}
</style> 
 </head> 
 <body> 
  <div id="wrapper"> 
   <div id="main-content"> 
    <div id="img-row"> 
     <a href=""> <button class="button">Lorem</button> </a> 
    </div> 
    <div id="img-row"> 
     <div class="img-item"> 
      <a href="#"> <img src="https://www.java2s.com/style/demo/Opera.png" class="images"> 
       <figcaption class="wp-caption-text">
         Lorem ips 
       </figcaption> </a> 
     </div> 
     <div class="img-item"> 
      <a href="#"> <img src="https://www.java2s.com/style/demo/Firefox.png" class="images"> 
       <figcaption class="wp-caption-text">
         Lorem ips 
       </figcaption> </a> 
     </div> 
    </div> 
    <div id="img-row"> 
     <div class="img-item"> 
      <a href="#"> <img src="https://www.java2s.com/style/demo/Firefox.png" class="images"> 
       <figcaption class="wp-caption-text">
         Lorem ips 
       </figcaption> </a> 
     </div> 
     <div class="img-item"> 
      <a href="#"> <img src="https://www.java2s.com/style/demo/Google-Chrome.png" class="images"> 
       <figcaption class="wp-caption-text">
         Lorem ips 
       </figcaption> </a> 
     </div> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials