color - HTML CSS CSS Animatable Property

HTML CSS examples for CSS Animatable Property:color

Introduction

In the following code the color of the following elements is animating from its initial value "red" to "yellow", and back to the initial value "red" again up to infinite times.

-webkit- prefix is for Chrome, Safari, Opera.

-moz- prefix is for Firefox.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html lang="en">
 <head>
  <title>Example of CSS color Property Animation</title>
  <style type="text/css">
.animated {<!-- www  .ja va 2  s  .  c  o  m-->
  color: red;
    -webkit-animation: test 4s infinite; 
    animation: test 4s infinite;
}

@-webkit-keyframes test {
    50% {color: yellow;}
}

@keyframes test {
    50% {color: yellow;}
}
</style>
 </head>
 <body>

  <p> </p>
  <h1 class="animated">This is an animated heading</h1>
  <p class="animated">This is an animated paragraph.</p>
 </body>
</html>

Related Tutorials