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

css3动画效果

2018-06-13 21:51 190 查看

css3动画效果

 要了解css3动画 必须要先了解@keyframes的规则

 @keyframes就是创建动画:使元素从一种样式逐渐变化为另一种样式的效果。

 创建动画时 需要至少绑定两个css样式(animation) :动画名称和动画时间,或者不会有动画效果。

案例:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>动画</title>
<style>
@keyframes myfistAnimate{
from{ background: #f00;}
to{ background: #00ff00;}

}

div { width: 100px;
height: 100px;
margin: 100px auto;
animation: myfistAnimate 5s infinite;}

</style>
</head>
<body>
<div>
css3动画
</div>
</body>
</html>
animation-delay 规定动画何时开始 默认值是0;

animation-iteration-count  规定动画播放次数、          infinite (无限循环播放)





阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: