<!DOCTYPE html>
<html lang="en-US">
<head>
<style>
div{
width: 100px;
height: 100px;
border: 1px solid #000;
line-height: 6;
text-align: center;
animation: myAnimation 2s infinite;
-webkit-animation: myAnimation 2s infinite; /* Safari 4.0 - 8.0 */
animation-direction: alternate;
-webkit-animation-direction: alternate; /* Safari 4.0 - 8.0 */
}
@-webkit-keyframes myAnimation {
0% {background-color: red;}
100% {background-color: green;}
}
@keyframes myAnimation {
0% {background-color: red;}
100% {background-color: green;}
}
</style>
</head>
<body>
<h1>CSS @keyframes Rule</h1>
<div>
Div
</div>
</body>
</html>