CSS Animation of Opacity Property - HTML CSS CSS Animation

HTML CSS examples for CSS Animation:Color

Description

CSS Animation of Opacity Property

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">

@-webkit-keyframes fadein {<!-- w w  w .j  a va2 s . c om-->
   0%   { opacity: 0; }
   100% { opacity: 1; }
}
@-moz-keyframes fadein {
   0%   { opacity: 0; }
   100% { opacity: 1; }
}
@keyframes fadein {
   0%   { opacity: 0; }
   100% { opacity: 1; }
}
#foo {
   background-color: green;
   color: white;
   -webkit-animation: fadein 2s ease-in alternate infinite;
   -moz-animation: fadein 2s ease-in alternate infinite;
   animation: fadein 2s ease-in alternate infinite;
}


      </style> 
 </head> 
 <body> 
  <div id="foo">
    This is Foo! 
  </div>  
 </body>
</html>

Related Tutorials