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;
            box-sizing: border-box;
        }
        body{
             100vw;
            height: 100vh;
            background-color: #505050;
            display: grid;
            place-items:center;
        }
        .box{
             400px;
            height: 400px;
            background: url(./pig.jpg);
            border-radius: 50%;
            display: grid;
            place-items:center;
            position: relative;
            color:#fff;
        }
        .box::before{
            content: "";
             400px;
            height: 400px;
            background:linear-gradient(0deg,#3498db,#8e44ad,#2ecc71,#e74c3c);
            border-radius: 50%;
            position: absolute;
            filter:blur(10px);
            animation: rotate 10s linear infinite 0s;
        }
        .box>div{
             300px;
            height: 300px;
            background-color: #505050;
            border-radius: 50%;
            z-index: 2;
            display: grid;
            place-items: center;
        }
        @keyframes rotate {
            to{
                transform: rotate(360deg);
            }
        }
    </style>
</head>
<body>
    <div class="box">
        <div></div>
    </div>
</body>
</html>
原文地址:https://www.cnblogs.com/500m/p/13542820.html