HTML 会动的蜡烛。




html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Candle Effect</title>
    <style>
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
            background-color: #1a1a1a;
        }

        .candle {
            position: relative;
            width: 30px;
            height: 100px;
            background-color: #fff;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
        }

        .flame {
            position: absolute;
            top: -20px;
            left: 50%;
            transform: translateX(-50%);
            width: 15px;
            height: 30px;
            background-color: #ffcc00;
            border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
            animation: flicker 0.1s infinite alternate;
        }

        .flame::before {
            content: '';
            position: absolute;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 10px;
            height: 10px;
            background-color: #ff6600;
            border-radius: 50%;
            opacity: 0.5;
        }

        @keyframes flicker {
            0% {
                transform: translateX(-50%) scale(1);
            }
            100% {
                transform: translateX(-50%) scale(1.1);
            }
        }

        .glow {
            position: absolute;
            top: -30px;
            left: 50%;
            transform: translateX(-50%);
            width: 40px;
            height: 40px;
            background-color: rgba(255, 204, 0, 0.2);
            border-radius: 50%;
            animation: glow 1s infinite alternate;
        }

        @keyframes glow {
            0% {
                box-shadow: 0 0 20px 10px rgba(255, 204, 0, 0.2);
            }
            100% {
                box-shadow: 0 0 30px 15px rgba(255, 204, 0, 0.4);
            }
        }
    </style>
</head>
<body>
    <div class="candle">
        <div class="flame"></div>
        <div class="glow"></div>
    </div>
</body>
</html>
相关推荐
小飞大王666几秒前
CSS基础知识
前端·css
Charlie_lll3 分钟前
学习Three.js–风车星系
前端·three.js
代码游侠3 分钟前
学习笔记——Linux内核与嵌入式开发1
linux·运维·前端·arm开发·单片机·嵌入式硬件·学习
玩电脑的辣条哥20 分钟前
幽灵回复AI已回复但前端不显示的排查与修复
前端·人工智能
石去皿33 分钟前
轻量级 Web 应用 —— 把一堆图片按指定频率直接拼成视频,零特效、零依赖、零命令行
前端·音视频
星夜落月1 小时前
Web-Check部署全攻略:打造个人网站监控与分析中心
运维·前端·网络
冰暮流星1 小时前
javascript之双重循环
开发语言·前端·javascript
爱敲点代码的小哥1 小时前
C#视觉模板匹配与动态绘制实战(绘制和保存,加载tb块,处理vpp脚本的方式)
前端·javascript·信息可视化
南风知我意9572 小时前
【前端面试3】初中级难度
前端·javascript·面试
霍理迪2 小时前
JS作用域与预解析
开发语言·前端·javascript