2018阿里巴巴前端面试

2018阿里巴巴前端面试
(1)使用CSS实现一个持续的动画效果 
部分代码:

animation: zz 5s infinite;
@keyframes zz {
                from {
                    left: 0px
                }
                to {
                    left: 100px
                }
1
2
3
4
5
6
7
8
主要考察animation的用法:

animation-name——>规定需要绑定到选择器的keyframe名称
animation-duration——>规定完成动画所花费的时间,以秒或毫秒计
animation-timing-function——>规定动画的速度曲线
animation-delay——>规定在动画开始之前的延迟
animation-iteration-count——>规定动画应该播放的次数
animation-direction——>规定是否应该轮流 反向播放动画
全部代码:

<!DOCTYPE html>
<html>

    <head>
        <meta charset="UTF-8">
        <title></title>
        <style type="text/css">
            * {
                padding: 0;
                margin: 0;
            }
            div {
                width: 100px;
                height: 100px;
                background-color: red;
                position: absolute;
                animation: zz 5s infinite;
            }
            @keyframes zz {
                from {
                    left: 0px
                }
                to {
                    left: 100px
                }
            }
        </style>
    </head>
    <body>
        <div></div>
    </body>
</html>

猜你喜欢

转载自blog.csdn.net/duyujian706709149/article/details/83589131