<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS3 background-size 属性动画示例- 基础教程(div.cn)</title>
<style>
.animated {
width: 300px;
height: 175px;
background: url("/run/images/clouds.png") center lightblue;
background-size: 25%;
-webkit-animation: test 4s infinite; /* Chrome, Safari, Opera */
animation: test 4s infinite;
}
/* Chrome, Safari, Opera */
@-webkit-keyframes test {
50% {background-size: 125%;}
}
/* Standard syntax */
@keyframes test {
50% {background-size: 125%;}
}
</style>
</head>
<body>
<p> <strong>注意</strong>:以下DIV元素的背景图像大小从其初始值“ 25%”动画化为“ 125%”,然后再次回到初始值“ 25%”,直至达到 无限次。</p>
<div class="animated"></div>
<p> <strong>警告:</strong>:CSS动画在Internet Explorer 9和更早版本中不起作用。</p>
</body>
</html>