make a div with multiple images responsive - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

make a div with multiple images responsive

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">
.slider{<!--from ww  w  .j  a  v  a 2 s.  c om-->
   width; 100%
   height: auto;
}
.slider img {
   width:25%;
}

@media (max-width: 992px)  {
   .slider img {
      width:49%;
   }

}

@media (max-width: 768px)  {
   .slider img {
      width:49%;
   }

}

@media (max-width: 480px)  {
   .slider img {
      width:91%;
   }

}
</style> 
 </head> 
 <body> 
  <div class="slider"> 
   <img src="https://www.java2s.com/style/demo/InternetExplorer.png" alt="slider"> 
   <img src="https://www.java2s.com/style/demo/Safari.png" alt="slider"> 
   <img src="https://www.java2s.com/style/demo/Safari.png" alt="slider"> 
   <img src="https://www.java2s.com/style/demo/Firefox.png" alt="slider"> 
  </div>  
 </body>
</html>

Related Tutorials