生日主题的烟花特效HTML,CSS,JS

图片展

完整代码
代码语言:javascript代码运行次数:0运行复制
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>生日烟花特效</title>
    <style>
        body {
            margin: 0;
            overflow: hidden;
            background: #000;
            color: white;
            font-family: 'Arial', sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
        }
        #fireworksCanvas {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }
        .happy-birthday {
            position: relative;
            z-index: 10;
            font-size: 3rem;
            font-weight: bold;
            text-align: center;
            color: #fff;
            text-shadow: 0 0 20px rgba(255, 255, 255, 0.8),
                         0 0 30px rgba(255, 255, 0, 0.8),
                         0 0 40px rgba(255, 0, 0, 0.8);
            animation: glow 2s infinite alternate;
        }
        @keyframes glow {
            from {
                text-shadow: 0 0 10px rgba(255, 255, 255, 0.6),
                             0 0 20px rgba(255, 255, 0, 0.6),
                             0 0 30px rgba(255, 0, 0, 0.6);
            }
            to {
                text-shadow: 0 0 20px rgba(255, 255, 255, 0.8),
                             0 0 40px rgba(255, 255, 0, 0.8),
                             0 0 60px rgba(255, 0, 0, 0.8);
            }
        }
    </style>
</head>
<body>
    <canvas id="fireworksCanvas"></canvas>
    <div class="happy-birthday">