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>
相关推荐
梦曦i5 分钟前
uni-storage 0.1.0 发布:TTL过期管理+多实例隔离
前端·storage·uni-app x
猫头_1 小时前
AI 流式传输工程指南:模型吐出半截 JSON,前端如何边收边渲染?
前端·javascript·llm
console.log('npc')2 小时前
第 1 章 项目概述与环境搭建
前端·人工智能·大模型
定栓2 小时前
Webpack迁到Vite第七节(二):全家桶移除 — Babel 全家桶深度分析
前端·webpack·node.js
IT_陈寒2 小时前
React组件莫名重渲染?你可能忘了这个小细节
前端·人工智能·后端
鶴哥只手遮天2 小时前
React 19.3.1 源码深度剖析-第 12 章(下)RSC 与 Flight 协议
前端·react.js·开源
deli0072 小时前
TCP 三次握手到底发几个包?丢包重传动画实测一遍
前端
盟接之桥2 小时前
盟接之桥谈线束数字化-按单入按单出:线束企业库存管理的破局之道
大数据·前端·网络·数据库·人工智能·制造
巴勒个啦2 小时前
Prompt Engineering 实战:5 个让 AI 生成生产级业务代码的工程模式
java·前端
去伪存真2 小时前
AI时代,古法编程的码农路在何方?
前端