CSS changing and transitioning background color - HTML CSS CSS Property

HTML CSS examples for CSS Property:background-color

Description

CSS changing and transitioning background color

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

html, body {
   height: 100%;
}
@-webkit-keyframes bgcolour {<!--   ww  w  .  jav a  2 s.com-->
   0% {background-color: red;}
   50% {background-color: green;}
   100% {background-color: blue;}
}
@-moz-keyframes bgcolour {
   0% {background-color: red;}
   50% {background-color: green;}
   100% {background-color: blue;}
}
@keyframes bgcolour {
   0% {background-color: red;}
   50% {background-color: green;}
   100% {background-color: blue;}
}
body {
   -webkit-animation: bgcolour 10s infinite alternate;
   -moz-animation: bgcolour 10s infinite alternate;
   animation: bgcolour 10s infinite alternate;
}


      </style> 
 </head> 
 <body>  
 </body>
</html>

Related Tutorials