美文网首页
22、CSS 使用 animation 自制缓冲动画

22、CSS 使用 animation 自制缓冲动画

作者: 小黄不头秃 | 来源:发表于2022-06-07 00:31 被阅读0次

代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>缓冲</title>
    <style>
        @keyframes test{
           from{
                margin-top : 10px;
            } 
            to{
                margin-top: 70px;
            }
        }
        .box{
            width: 170px;
            height: 100px;
            border-radius: 25px;
            padding-left: 50px;
            margin: 200px auto;
            background-color: tan;
            position: relative;
        }
        .box1{
            position: absolute;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background-color: white;
            animation: test 0.5s infinite alternate-reverse ;
        }
        .box2{
            position: absolute;
            left: 75px;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background-color: white;
            animation: test 0.5s infinite alternate-reverse 0.1s;
        }
        .box3{
            position: absolute;
            left: 100px;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background-color: white;
            animation: test 0.5s infinite alternate-reverse 0.2s;
        }
        .box4{
            position: absolute;
            left: 125px;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background-color: white;
            animation: test 0.5s infinite alternate-reverse 0.3s;
        }
        .box5{
            position: absolute;
            left: 150px;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background-color: white;
            animation: test 0.5s infinite alternate-reverse 0.4s;
        }
        
    </style>
</head>
<body>
    <div class="box">
        <div class="box1"></div>
        <div class="box2"></div>
        <div class="box3"></div>
        <div class="box4"></div>
        <div class="box5"></div>
    </div>
</body>
</html>
34.jpg

相关文章

网友评论

      本文标题:22、CSS 使用 animation 自制缓冲动画

      本文链接:https://www.haomeiwen.com/subject/alqtmrtx.html