Align an image in the center - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Align

Description

Align an image in the center

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">
.single ul {<!--   w ww.  j a  v a 2s. c o  m-->
   list-style-type:none;
}

.single li {
   padding:0px;
   width:161px;
   height:241px;
   margin:11px;
   overflow:hidden;
   float:left;
   -webkit-transition:box-shadow 0.6s ease;
   -moz-transition:box-shadow 0.6s ease;
   -o-transition:box-shadow 0.6s ease;
   -ms-transition:box-shadow 0.6s ease;
   transition:box-shadow 0.6s ease;
}

.single img {
   height:241px;
}

.single img {
   margin-left:-21px;
}

.single li:hover {
   -webkit-box-shadow:0px 0px 8px Chartreuse;
   box-shadow:0px 0px 8px yellow;
}
</style> 
 </head> 
 <body> 
  <div id="second" class="single"> 
   <ul> 
    <li> <a href="" rel="lightbox[photos]"> <img src="https://www.java2s.com/style/demo/InternetExplorer.png" alt=""> </a> </li> 
    <li> <a href="" rel="lightbox[photos]"> <img class="centered" src="https://www.java2s.com/style/demo/Firefox.png" alt=""> </a> </li> 
    <li> <a href="" rel="lightbox[photos]"> <img src="https://www.java2s.com/style/demo/InternetExplorer.png" alt=""> </a> </li> 
    <li> <a href="" rel="lightbox[photos]"> <img src="https://www.java2s.com/style/demo/Google-Chrome.png" alt=""> </a> </li> 
    <li> <a href="" rel="lightbox[photos]"> <img src="https://www.java2s.com/style/demo/Safari.png" alt=""> </a> </li> 
    <li> <a href="" rel="lightbox[photos]"> <img class="centered" src="https://www.java2s.com/style/demo/Google-Chrome.png" alt=""> </a> </li> 
   </ul> 
  </div>  
 </body>
</html>

Related Tutorials