CSS3孔明灯特效

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS3孔明灯特效</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: linear-gradient(to bottom, #000428, #0a1a3a);
            overflow: hidden;
            font-family: Arial, sans-serif;
        }

        .container {
            position: relative;
            width: 100%;
            height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }

        .title {
            color: #fff;
            font-size: 2.5em;
            text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
            margin-bottom: 30px;
            z-index: 10;
        }

        .lantern {
            position: absolute;
            width: 60px;
            height: 80px;
            animation: float 15s linear infinite;
        }

        .lantern:nth-child(1) {
            left: 10%;
            top: 100%;
            animation-delay: 0s;
            animation-duration: 20s;
        }

        .lantern:nth-child(2) {
            left: 20%;
            top: 100%;
            animation-delay: 3s;
            animation-duration: 18s;
        }

        .lantern:nth-child(3) {
            left: 30%;
            top: 100%;
            animation-delay: 6s;
            animation-duration: 22s;
        }

        .lantern:nth-child(4) {
            left: 40%;
            top: 100%;
            animation-delay: 2s;
            animation-duration: 17s;
        }

        .lantern:nth-child(5) {
            left: 50%;
            top: 100%;
            animation-delay: 5s;
            animation-duration: 19s;
        }

        .lantern:nth-child(6) {
            left: 60%;
            top: 100%;
            animation-delay: 1s;
            animation-duration: 21s;
        }

        .lantern:nth-child(7) {
            left: 70%;
            top: 100%;
            animation-delay: 4s;
            animation-duration: 16s;
        }

        .lantern:nth-child(8) {
            left: 80%;
            top: 100%;
            animation-delay: 7s;
            animation-duration: 23s;
        }

        .lantern-body {
            position: relative;
            width: 100%;
            height: 100%;
            background: #ff4d4d;
            border-radius: 50% 50% 5% 5%;
            box-shadow: 0 0 20px #ff8c00, 
                        inset 0 0 10px rgba(255, 255, 255, 0.5);
        }

        .lantern-body:before {
            content: '';
            position: absolute;
            width: 90%;
            height: 10px;
            background: #ffcc00;
            top: 5px;
            left: 5%;
            border-radius: 5px;
        }

        .lantern-body:after {
            content: '';
            position: absolute;
            width: 80%;
            height: 15px;
            background: #ffcc00;
            bottom: -10px;
            left: 10%;
            border-radius: 0 0 10px 10px;
        }

        .lantern-light {
            position: absolute;
            width: 30px;
            height: 40px;
            background: #ffcc00;
            border-radius: 50%;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            box-shadow: 0 0 30px 10px #ffcc00;
            animation: flicker 2s infinite alternate;
        }

        .stars {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 0;
        }

        .star {
            position: absolute;
            background: white;
            border-radius: 50%;
            animation: twinkle 2s infinite alternate;
        }

        .star:nth-child(1) {
            width: 2px;
            height: 2px;
            top: 20%;
            left: 15%;
            animation-delay: 0s;
        }

        .star:nth-child(2) {
            width: 3px;
            height: 3px;
            top: 30%;
            left: 80%;
            animation-delay: 0.5s;
        }

        .star:nth-child(3) {
            width: 1px;
            height: 1px;
            top: 60%;
            left: 25%;
            animation-delay: 1s;
        }

        .star:nth-child(4) {
            width: 2px;
            height: 2px;
            top: 70%;
            left: 70%;
            animation-delay: 1.5s;
        }

        .star:nth-child(5) {
            width: 3px;
            height: 3px;
            top: 40%;
            left: 50%;
            animation-delay: 0.8s;
        }

        .moon {
            position: absolute;
            width: 100px;
            height: 100px;
            background: #f5f5dc;
            border-radius: 50%;
            top: 50px;
            right: 50px;
            box-shadow: 0 0 30px #f5f5dc;
        }

        .link {
            position: absolute;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 10;
        }

        .link a {
            color: white;
            background: rgba(255, 140, 0, 0.7);
            padding: 10px 20px;
            border-radius: 30px;
            text-decoration: none;
            font-weight: bold;
            transition: all 0.3s;
        }

        .link a:hover {
            background: rgba(255, 140, 0, 0.9);
            box-shadow: 0 0 15px rgba(255, 140, 0, 0.7);
        }

        @keyframes float {
            0% {
                transform: translateY(0) rotate(0deg);
                opacity: 0;
            }
            10% {
                opacity: 1;
            }
            90% {
                opacity: 1;
            }
            100% {
                transform: translateY(-100vh) rotate(10deg);
                opacity: 0;
            }
        }

        @keyframes flicker {
            0% {
                opacity: 0.8;
                box-shadow: 0 0 30px 10px #ffcc00;
            }
            100% {
                opacity: 1;
                box-shadow: 0 0 40px 15px #ffcc00;
            }
        }

        @keyframes twinkle {
            0% {
                opacity: 0.3;
            }
            100% {
                opacity: 1;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <h1 class="title">夜空孔明灯</h1>
        
        <div class="stars">
            <div class="star"></div>
            <div class="star"></div>
            <div class="star"></div>
            <div class="star"></div>
            <div class="star"></div>
        </div>
        
        <div class="moon"></div>
        
        <div class="lantern">
            <div class="lantern-body">
                <div class="lantern-light"></div>
            </div>
        </div>
        
        <div class="lantern">
            <div class="lantern-body">
                <div class="lantern-light"></div>
            </div>
        </div>
        
        <div class="lantern">
            <div class="lantern-body">
                <div class="lantern-light"></div>
            </div>
        </div>
        
        <div class="lantern">
            <div class="lantern-body">
                <div class="lantern-light"></div>
            </div>
        </div>
        
        <div class="lantern">
            <div class="lantern-body">
                <div class="lantern-light"></div>
            </div>
        </div>
        
        <div class="lantern">
            <div class="lantern-body">
                <div class="lantern-light"></div>
            </div>
        </div>
        
        <div class="lantern">
            <div class="lantern-body">
                <div class="lantern-light"></div>
            </div>
        </div>
        
        <div class="lantern">
            <div class="lantern-body">
                <div class="lantern-light"></div>
            </div>
        </div>
        
        <div class="link">
         
        </div>
    </div>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值