css3动画效果

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 (无限循环播放)





猜你喜欢

转载自blog.csdn.net/w859265708/article/details/80685532