实现彩虹效果

本文介绍了一个使用HTML和CSS实现的彩虹动画效果。通过设置特定的样式属性和关键帧动画,可以在网页上呈现出动态旋转的彩虹图案及其阴影效果。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>caihong</title>
    <style>
        

        .container{
            width: 170px;
            height: 170px;
            position: relative;
            margin: 250px auto;
        }



        .rainbow{
            width: 70px;
            height: 70px;
            position: absolute;
            top: 70px;
            left: 80px;
            margin-left: -40px;
            border-radius: 170px 0 0 0;
            box-shadow: #fb323c -2px -2px 0 1px,
                #f99716 -4px -4px 0 3px,
                #fee124 -6px -6px 0 5px,
                #afde2e -8px -8px 0 7px,
                #6ad7f8 -10px -10px 0 9px,
                #60b1f5 -12px -12px 0 11px,
                #a3459b -14px -14px 0 13px;
            animation: rainbow 5s ease-in-out infinite;
            transform: rotate(40deg);
        }

        @keyframes rainbow{
            50%{
                transform: rotate(50deg);
            }
        }



        .rainbow::after{
            content: '';
            width: 120px;
            height: 15px;
            position: absolute;
            bottom: -23px;
            left: 17px;
            background: #000;
            border-radius: 50%;
            opacity: 0.2;
            animation: rainbow_shadow 5s ease-in-out infinite;
            transform: rotate(-40deg);
            transform-origin: 50% 50%;
        }

        @keyframes rainbow_shadow{
            50%{
                transform: rotate(-50deg) translate(10px) scale(0.7);
                opacity: 0.05;
            }
        }


    </style>
</head>
<body>
    <div class="container">
        <div class="rainbow"></div>
    </div>
</body>
</html>

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值