Responsive thumbnail grid resize on width - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Responsive thumbnail grid resize on width

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">
html, body {
   margin:0;
   padding:0;
}

.content {<!--   www  .  j  a v  a  2  s  .co  m-->
   font-size:11px;
   margin:0 auto 0;
   width:76%;
   max-width:751px;
   text-align:left;
   padding-bottom:4em;
   background-color:Chartreuse;
}

p {
   font-size:3em;
   line-height:2.5em;
   letter-spacing:normal;
   font-style:normal;
   font-weight:normal;
   margin:0 0 2em 0;
}

.thumb-grid {
   display:block;
   width:100%;
   padding:0;
   margin:4em 0 4em 0;
   background-color:yellow;
   list-style-type:none;
}

.thumb-grid:after {
   content:'';
   width:0;
   display:block;
   clear:both;
}

.thumb-grid li {
   position:relative;
   overflow:hidden;
   width:21%;
   display:block;
   float:left;
   padding-bottom:21%;
}

.thumb-grid img {
   position:absolute;
   left:0;
   top:0;
   cursor:pointer;
   width:100%;
   background-color:blue;
}

.thumb-grid img:hover {
   opacity:0.6;
}
</style> 
 </head> 
 <body> 
  <div class="content"> 
   <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed quam pharetra, tincidunt tortor in, pharetra nisl. M</p> 
   <ul class="thumb-grid"> 
    <li> <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> </li> 
    <li> <img src="https://www.java2s.com/style/demo/Safari.png"> </li> 
    <li> <img src="https://www.java2s.com/style/demo/InternetExplorer.png"> </li> 
    <li> <img src="https://www.java2s.com/style/demo/Safari.png"> </li> 
    <li> <img src="https://www.java2s.com/style/demo/Firefox.png"> </li> 
    <li> <img src="https://www.java2s.com/style/demo/Safari.png"> </li> 
    <li> <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> </li> 
    <li> <img src="https://www.java2s.com/style/demo/Google-Chrome.png"> </li> 
   </ul> 
   <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed quam pharetra, tincidunt tortor in, pharetra nisl. Maecenas aliquam luctus mauris, vitae venenatis diam imperdiet vel. Donec tortor diam, p</p> 
  </div>  
 </body>
</html>

Related Tutorials