Make background color change frequently with animation - HTML CSS CSS Animatable Property

HTML CSS examples for CSS Animatable Property:background

Description

Make background color change frequently with animation

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Blink</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

@-webkit-keyframes blackWhite {<!--  ww w . j  av  a  2 s. c om-->
   0% { background-color: red; }
   50% { background-color: red; }
   51% { background-color: black; }
   100% { background-color: black; }
}
@-webkit-keyframes blackWhiteFade {
   0% { background-color: red; }
   50% { background-color: black; }
   100% { background-color: red; }
}
.blinkdiv {
   height: 100px;
   background-color: black;
   -webkit-animation-name: blackWhite;
   -webkit-animation-iteration-count: infinite;
   -webkit-animation-duration: 2s;
}


      </style> 
 </head> 
 <body> 
  <div class="blinkdiv"> 
  </div>  
 </body>
</html>

Related Tutorials