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>
相关推荐
叶梅树30 分钟前
DocsJS npmjs 自动化发布复盘(Trusted Publisher)
前端·npm
我命由我1234540 分钟前
Element Plus - Form 的 resetField 方法观察记录
开发语言·前端·javascript·vue.js·html·html5·js
清空mega1 小时前
《Vue3 项目结构详解:components、views、assets、router、stores 到底该怎么理解?》
前端·javascript·vue.js
雨雨雨雨雨别下啦2 小时前
Vue——小白也能学!Day6
前端·javascript·vue.js
XPoet2 小时前
AI 编程工程化:Hook——AI 每次操作前后的自动检查站
前端·后端·ai编程
難釋懷3 小时前
RedisTemplate配置读写分离
前端·bootstrap·html
冰暮流星3 小时前
javascript如何实现删除数组里面的重复元素
开发语言·前端·javascript
网络点点滴4 小时前
透传属性$attrs
前端·javascript·vue.js
90后的晨仔4 小时前
OpenClaw macOS 完整安装指南
前端
Moment4 小时前
尤雨溪宣布 Vite+ 正式开源,前端工具链要大一统了
前端·javascript·面试