Responsive CSS Circles with image - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Responsive CSS Circles with image

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">
.container {<!--  w  ww . j  ava 2s. c o m-->
   position:relative;
   float:left;
   width:51%;
   height:0;
   padding-bottom:51%;
   background-color:Chartreuse;
}

.circle {
   position:absolute;
   width:100%;
   left:0;
   top:0;
   height:auto;
   z-index:2;
}

@media (max-width: 320px)  {
   .container {
      width:100%;
      padding-bottom:100%;
   }

}

@media (min-width: 321px) and (max-width: 800px)  {
   .container {
      width:51%;
      padding-bottom:51%;
   }

}

@media (min-width: 801px)  {
   .container {
      width:26%;
      padding-bottom:26%;
   }

}
</style> 
 </head> 
 <body> 
  <div class="container"> 
   <img class="circle" src="https://www.java2s.com/style/demo/Safari.png"> 
  </div> 
  <div class="container"> 
   <img class="circle" src="https://www.java2s.com/style/demo/Google-Chrome.png"> 
  </div> 
  <div class="container"> 
   <img class="circle" src="https://www.java2s.com/style/demo/InternetExplorer.png"> 
  </div> 
  <div class="container"> 
   <img class="circle" src="https://www.java2s.com/style/demo/Opera.png"> 
  </div>  
 </body>
</html>

Related Tutorials