

CSS3 Examples
11. CSS3 Animation example 2.
<!DOCTYPE html>
<html>
<head>
<title>Untitled Document</title>
<style>
@keyframes anim1
{
from{ background-color:#0CF; transform:rotate(0deg);}
to { background-color:#F0F; transform:rotate(360deg);}
}
@-webkit-keyframes anim1
{
from{ background-color:#0CF; -webkit-transform:rotate(0deg);}
to { background-color:#F0F; -webkit-transform:rotate(360deg);}
}
#box{
width:100px;
height:100px;
font-size:26px;
background-color:#0CF;
border-radius:5px;
box-shadow:10px 10px 2px #999999;
text-align:center;
padding-top:20px;
position:absolute;
top:200px;
left:500px;
}
#box:hover{
animation:anim1 5s;
-webkit-animation:anim1 5s;
}
</style>
</head>
<body>
<div id="box">
<img src="images/anjelina.jpg" width="100">
</div>
</body>
</html>
Output :(Mouse over the image)