直接上代码
<!DOCTYPE html>
<html>
<head>
<style>
div
{
width:100px;
height:100px;
background:red;
animation:myfirst 5s linear infinite;
}
@keyframes myfirst
{
0% {background:red;
width:100px;
height:100px;}
50% {background:yellow;
width:150px;
height:150px;}
100% {background:red;
width:100px;
height:100px;}
}
</style>
</head>
<body>
<div></div>
<p><b>注释:</b>本例在 Internet Explorer 中无效。</p>
</body>
</html>
结果自行运行展示: