<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Rotating div</title>
<style>
div
{
width:250px;
height:250px;
background:blue;
position:relative;
animation:rotating 1.2s linear infinite
//animation:rotating 5s infinite;
-webkit-animation:rotating 5s infinite; /*Safari and Chrome*/
}
@keyframes rotating{
from{transform:rotate(0)}
to{transform:rotate(360deg)}
}
</style>
</head>
<body>
<div><img style="width:250px;height:250px;" src="timg.jpg">
</div>
</body>
</html>
下圖爲div背景圖
效果如下圖所示