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>
相关推荐
IT_陈寒15 分钟前
SpringBoot性能翻倍秘籍:5个90%开发者不知道的JVM调优实战技巧
前端·人工智能·后端
前端灵派派1 小时前
openlayer源码转cesium
前端
Jacob02341 小时前
JavaScript 的进化之旅 Part 2:现代特性与算法优化实战
前端·javascript·性能优化
qb1 小时前
vue3.5.18源码:深入watch api底层实现
前端·vue.js·架构
OEC小胖胖1 小时前
掌握表单:React中的受控组件与表单处理
前端·javascript·react.js·前端框架·react·web
coding随想1 小时前
手机旋转也能触发代码?揭秘前端DeviceOrientation事件的神奇力量!
前端
Mintopia1 小时前
AIGC 训练数据的清洗与标注:技术痛点与自动化方案
前端·javascript·aigc
小喷友1 小时前
第9章 鸿蒙微内核与系统架构
前端·app·harmonyos
Hilaku2 小时前
我最近面试前端,发现一个很有意思的现象..
前端·javascript·面试
Js_cold2 小时前
Notepad++常用设置
前端·javascript·fpga开发·notepad++