HTML+CSS 彩虹旋转加载

实现了一个简单的加载动画效果,包括一个圆形的加载器,它由三个不同颜色的圆环组成,每个圆环都沿着圆形路径旋转。这个加载器是通过使用CSS动画和伪元素来实现的。背景色为黑色。

实现代码

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>彩虹旋转加载</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        body {
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background-color: #212121;
        }

        .loader {
            width: 200px;
            height: 200px;
            position: relative;
            border-radius: 50%;
            border: 4px solid transparent;
            border-top-color: #4bc0c8;
            animation: spin 2s linear infinite;
        }

        .loader::before {
            content: "";
            position: absolute;
            left: 5px;
            top: 5px;
            right: 5px;
            bottom: 5px;
            border-radius: 50%;
            border: 4px solid transparent;
            border-top-color: #c779d0;
            animation: spin 3s linear infinite;
        }

        .loader::after {
            content: "";
            position: absolute;
            left: 15px;
            top: 15px;
            right: 15px;
            bottom: 15px;
            border-radius: 50%;
            border: 4px solid transparent;
            border-top-color: #feac5e;
            animation: spin 1.5s linear infinite;
        }

        @keyframes spin {
            0% {
                transform: rotate(0deg);
            }

            100% {
                transform: rotate(360deg);
            }
        }
    </style>
</head>

<body>
    <div class="loader"></div>
</body>

</html>
HTML

MXROC

推广

 继续浏览关于 HTMLCSS加载 的文章

 本文最后更新于 2024/08/03 14:45:42,可能因经年累月而与现状有所差异

 本文链接: MXROC > 前端 > HTML+CSS 彩虹旋转加载

MXROC
本文预计阅读时间需 15 秒