HTML CSS examples for CSS Animation:Fade
Cross fading animation
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #index_banner img { position:absolute; animation: cf4FadeInOut 15s; -webkit-animation: cf4FadeInOut 15s; -webkit-animation-iteration-count: infinite; animation-iteration-count: infinite; animation-timing-function:ease-in-out; } #index_banner img:nth-child(odd) { -webkit-animation-delay: -8s; animation-delay: 8s; animation-timing-function:ease-in-out; } @-webkit-keyframes cf4FadeInOut {<!-- w w w . j av a2 s. c o m--> 0% { opacity:0; } 30% { opacity:0; } 40%{ opacity:1; } 75%{ opacity:1; } 85%{ opacity:1; } 100% { opacity:0; } } @keyframes cf4FadeInOut { 0% { opacity:0; } 30% { opacity:0; } 40%{ opacity:1; } 75%{ opacity:1; } 85%{ opacity:1; } 100% { opacity:0; } } </style> </head> <body> <div id="index_banner"> <img class="bottom" src="https://www.java2s.com/style/demo/Firefox.png" alt="INDEX BANNER 1"> <img class="top" src="https://www.java2s.com/style/demo/Opera.png" alt="INDEX BANNER 2"> </div> </body> </html>