侧边栏壁纸
博主头像
怪客のBlog 博主等级

行动起来,活在当下

  • 累计撰写 35 篇文章
  • 累计创建 1 个标签
  • 累计收到 1 条评论

目 录CONTENT

文章目录

Css实现加载动画

怪客
2023-01-18 / 0 评论 / 0 点赞 / 41 阅读 / 0 字

代码

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title>正在加载中...</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        body {
            margin: 0;
        }

        .loader {
            position: absolute;
            top: 50%;
            left: 40%;
            margin-left: 10%;
            transform: translate3d(-50%, -50%, 0);
        }

        .dot {
            width: 24px;
            height: 24px;
            background: #3ac;
            border-radius: 100%;
            display: inline-block;
            animation: slide 1s infinite;
        }

            .dot:nth-child(1) {
                animation-delay: 0.1s;
                background: #32aacc;
            }

            .dot:nth-child(2) {
                animation-delay: 0.2s;
                background: #64aacc;
            }

            .dot:nth-child(3) {
                animation-delay: 0.3s;
                background: #96aacc;
            }

            .dot:nth-child(4) {
                animation-delay: 0.4s;
                background: #c8aacc;
            }

            .dot:nth-child(5) {
                animation-delay: 0.5s;
                background: #faaacc;
            }

        @-moz-keyframes slide {
            0% {
                transform: scale(1);
            }

            50% {
                opacity: 0.3;
                transform: scale(2);
            }

            100% {
                transform: scale(1);
            }
        }

        @-webkit-keyframes slide {
            0% {
                transform: scale(1);
            }

            50% {
                opacity: 0.3;
                transform: scale(2);
            }

            100% {
                transform: scale(1);
            }
        }

        @-o-keyframes slide {
            0% {
                transform: scale(1);
            }

            50% {
                opacity: 0.3;
                transform: scale(2);
            }

            100% {
                transform: scale(1);
            }
        }

        @keyframes slide {
            0% {
                transform: scale(1);
            }

            50% {
                opacity: 0.3;
                transform: scale(2);
            }

            100% {
                transform: scale(1);
            }
        }
    </style>
</head>
<body>
    <div class="loader">
        <div class="dot"></div>
        <div class="dot"></div>
        <div class="dot"></div>
        <div class="dot"></div>
        <div class="dot"></div>
    </div>
</body>
</html>

效果

0

评论区