loading效果

106 阅读1分钟

模仿BOSS直聘loading效果

0d1fee2263db4097d591f53b5359c36.png 代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>loading</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            display: grid;
            place-content: center;
            height: 100vh;
        }
        h1{
            display: inline-block;
            color: #ccc;
            padding: 0 2px;
        }
        p{
            color: #888;
            text-align: center;
        }
        .jump1{
            animation: jump 0.6s ease-in-out infinite;
        }
        .jump2{
            animation: jump 0.6s ease-in-out 0.2s infinite;
        }

        .jump3{
            animation: jump 0.6s ease-in-out 0.4s infinite;
        }

        .jump4{
            animation: jump 0.6s ease-in-out 0.6s infinite;
        }
        @keyframes jump{
            0%{
                transform: translateY(0);
            }
            50%{
                transform: translateY(-10px);
            }
            100%{
                transform: translateY(0);
            }
        }
    </style>
</head>
<body>
    <div class="box">
        <div>
            <h1 class="jump1">B</h1>
            <h1 class="jump2">O</h1>
            <h1 class="jump3">S</h1>
            <h1 class="jump4">S</h1>
        </div>

        <p>正在加载中...</p>
    </div>
<script>
</script>
</body>
</html>

运行结果如下:

image.png