深夜的烂笔头
技术 12 次浏览 3 分钟阅读

会动的背景动画

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>极简编程网站</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            position: relative;
            overflow-x: hidden;
        }

        .bg-icons {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 1;
            opacity: 0.15;
        }

        .icon {
            position: absolute;
            color: white;
            font-size: 24px;
            animation: float 20s infinite ease-in-out;
        }

        .icon:nth-child(1) { top: 10%; left: 15%; animation-delay: 0s; }
        .icon:nth-child(2) { top: 20%; right: 20%; animation-delay: -2s; }
        .icon:nth-child(3) { top: 35%; left: 8%; animation-delay: -4s; }
        .icon:nth-child(4) { top: 50%; right: 12%; animation-delay: -6s; }
        .icon:nth-child(5) { top: 65%; left: 25%; animation-delay: -8s; }
        .icon:nth-child(6) { top: 75%; right: 30%; animation-delay: -10s; }
        .icon:nth-child(7) { top: 15%; left: 50%; animation-delay: -12s; }
        .icon:nth-child(8) { top: 40%; right: 45%; animation-delay: -14s; }
        .icon:nth-child(9) { top: 80%; left: 60%; animation-delay: -16s; }
        .icon:nth-child(10) { top: 25%; left: 75%; animation-delay: -18s; }

        @keyframes float {
            0%, 100% {
                transform: translate(0, 0) rotate(0deg);
            }
            25% {
                transform: translate(10px, -10px) rotate(5deg);
            }
            50% {
                transform: translate(-5px, 10px) rotate(-5deg);
            }
            75% {
                transform: translate(15px, 5px) rotate(3deg);
            }
        }

        .content {
            position: relative;
            z-index: 2;
            max-width: 800px;
            margin: 0 auto;
            padding: 60px 30px;
            color: white;
        }

        h1 {
            font-size: 3em;
            margin-bottom: 20px;
            font-weight: 300;
            letter-spacing: 2px;
        }

        p {
            font-size: 1.2em;
            line-height: 1.8;
            margin-bottom: 30px;
            font-weight: 300;
        }

        .code-block {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 8px;
            padding: 20px;
            margin: 30px 0;
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        .code-block code {
            color: #fff;
            font-family: 'Courier New', monospace;
            font-size: 0.95em;
        }

        .btn {
            display: inline-block;
            padding: 12px 30px;
            background: rgba(255, 255, 255, 0.2);
            color: white;
            text-decoration: none;
            border-radius: 25px;
            border: 2px solid white;
            transition: all 0.3s;
            backdrop-filter: blur(10px);
        }

        .btn:hover {
            background: white;
            color: #667eea;
            transform: translateY(-2px);
        }
    </style>
</head>
<body>
    <div class="bg-icons">
        <!-- Bug图标 -->
        <div class="icon">🐛</div>
        
        <!-- Ctrl键 -->
        <div class="icon" style="font-size: 18px; border: 2px solid white; padding: 8px 12px; border-radius: 5px;">Ctrl</div>
        
        <!-- 代码符号 -->
        <div class="icon" style="font-size: 32px;">&lt;/&gt;</div>
        
        <!-- 咖啡 -->
        <div class="icon">☕</div>
        
        <!-- Git分支 -->
        <div class="icon" style="font-size: 28px;">⎇</div>
        
        <!-- 括号 -->
        <div class="icon" style="font-size: 36px;">{}</div>
        
        <!-- 终端符号 -->
        <div class="icon" style="font-size: 26px;">$_</div>
        
        <!-- Bug -->
        <div class="icon">🐞</div>
        
        <!-- 键盘 -->
        <div class="icon">⌨️</div>
        
        <!-- 分号 -->
        <div class="icon" style="font-size: 36px;">;</div>
    </div>

    <div class="content">
        <h1>极简编程</h1>
        <p>用最简单的方式,编写最优雅的代码。追求代码的本质,摒弃多余的复杂性。</p>
        
        <div class="code-block">
            <code>
                function simplify(code) {<br>
                &nbsp;&nbsp;return code.reduce(complexity => clarity);<br>
                }
            </code>
        </div>

        <p>编程不应该是复杂的。好的代码就像好的文章,简洁、清晰、有力量。</p>

        <a href="#" class="btn">开始探索</a>
    </div>
</body>
</html>

0

  1. 此文章尚无评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注