Responsive CSS image cross-fade - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Responsive CSS image cross-fade

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">
#cf {<!--   w  w  w . ja  v a2 s.c o m-->
   position:relative;
   width:51%;
   margin:0 auto;
}

#cf img {
   position:absolute;
   left:0;
   width:100%;
   height:auto;
   -webkit-transition:opacity 2s ease-in-out;
   -moz-transition:opacity 2s ease-in-out;
   -o-transition:opacity 2s ease-in-out;
   transition:opacity 2s ease-in-out;
}

#cf img.top:hover {
   opacity:0;
}
</style> 
 </head> 
 <body> 
  <div id="cf"> 
   <img class="bottom" src="https://www.java2s.com/style/demo/Google-Chrome.png"> 
   <img class="top" src="https://www.java2s.com/style/demo/Google-Chrome.png"> 
  </div>  
 </body>
</html>

Related Tutorials