您的位置:首页 > Web前端 > CSS

css 动画效果

2015-05-14 22:48 337 查看
css3的动画需要遵循@keyframes规制
<div>动画效果</div>

div{

width: 100px;
height: 100px;
background: red;
/* 相对布局*/
position: relative;
animation: anim 5s infinite alternate;
-webkit-animation: anim 5s infinite alternate;

}
@keyframes anim{

0%{background: red;left: 0px;top: 0px}
25%{background: blue;left: 200px;top: 0px}
50%{background: orange;left: 200px;top: 200px}
75%{background: yellow; left: 0px;top: 200px}
100%{background: red;left: 0;top: 0px}
}
@-webkit-keyframes anim{

0%{background: red;left: 0px;top: 0px}
25%{background: blue;left: 200px;top: 0px}
50%{background: orange;left: 200px;top: 200px}
75%{background: yellow; left: 0px;top: 200px}
100%{background: red;left: 0;top: 0px};
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: