照片墙的实现  前端

发布于 23 天前  35 次阅读


<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>梦幻二次元画廊</title>
    <style>
        body {
            background: linear-gradient(135deg, #ffe6f0 0%, #c3e3ff 100%);
            min-height: 100vh;
            padding: 20px;
            font-family: '幼圆', 'Comic Sans MS', cursive;
            overflow-x: hidden;
        }

        .container {
            max-width: 1200px;
            margin: 0 auto;
            position: relative;
        }

        h1 {
            text-align: center;
            color: #ff69b4;
            text-shadow: 2px 2px 0px #fff,
                       4px 4px 0px rgba(255,105,180,0.3);
            font-size: 3em;
            margin-bottom: 40px;
            position: relative;
            display: inline-block;
            padding: 0 30px;
        }

        h1::before {
            content: '🎨';
            position: absolute;
            left: -20px;
            top: -15px;
            font-size: 1.5em;
            animation: sparkle 2s infinite;
        }

        .photo-wall {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
            gap: 30px;
            padding: 30px;
            position: relative;
        }

        .photo-item {
            position: relative;
            border-radius: 20px;
            overflow: hidden;
            transform: rotate(-3deg);
            transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            background: white;
            box-shadow: 0 12px 25px rgba(0,0,0,0.15);
            cursor: pointer;
            border: 3px solid white;
        }

        .photo-item:nth-child(even) {
            transform: rotate(2deg);
        }

        .photo-item:hover {
            transform: rotate(0deg) scale(1.15);
            box-shadow: 0 20px 40px rgba(0,0,0,0.2);
        }

        .photo-item::before {
            content: '';
            position: absolute;
            top: -15px;
            left: -15px;
            right: -15px;
            bottom: -15px;
            background: linear-gradient(45deg,
                #ff69b4 0%,
                #ffb6c1 25%,
                #87cefa 50%,
                #98fb98 75%);
            z-index: -1;
            opacity: 0;
            transition: opacity 0.3s;
            filter: blur(15px);
        }

        .photo-item:hover::before {
            opacity: 0.4;
        }

        .photo-item img {
            width: 100%;
            height: 350px;
            object-fit: cover;
            border-radius: 15px;
            transition: all 0.3s ease;
            position: relative;
            clip-path: polygon(0 0, 100% 0, 100% 90%, 90% 100%, 0 100%);
        }

        /* 漫画对话框样式标签 */
        .photo-tag {
            position: absolute;
            bottom: 15px;
            left: 15px;
            background: rgba(255,105,180,0.95);
            color: white;
            padding: 8px 15px;
            border-radius: 20px;
            font-size: 1em;
            font-weight: bold;
            box-shadow: 3px 3px 0 rgba(0,0,0,0.1);
            transform: rotate(-2deg);
            border: 2px solid white;
        }

        .photo-tag::before {
            content: '';
            position: absolute;
            left: 15px;
            bottom: -10px;
            border-width: 10px 8px 0;
            border-style: solid;
            border-color: rgba(255,105,180,0.95) transparent transparent;
        }

        /* 新增角色装饰元素 */
        .anime-character {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 150px;
            z-index: 999;
            animation: float 3s ease-in-out infinite;
        }

        /* 花瓣飘落效果 */
        .petal {
            position: fixed;
            width: 15px;
            height: 15px;
            background: rgba(255,182,193,0.7);
            clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
            animation: fall linear infinite;
        }

        @keyframes sparkle {
            0% { transform: scale(1); }
            50% { transform: scale(1.2) rotate(15deg); }
            100% { transform: scale(1); }
        }

        @keyframes fall {
            to { transform: translateY(100vh) rotate(360deg); }
        }

        /* 新增霓虹边框效果 */
        .neon-border {
            position: relative;
            overflow: hidden;
        }

        .neon-border::after {
            content: '';
            position: absolute;
            top: -2px;
            left: -2px;
            right: -2px;
            bottom: -2px;
            background: linear-gradient(45deg,
                #ff69b4, #ffb6c1, #87cefa, #98fb98);
            z-index: -1;
            filter: blur(5px);
            opacity: 0;
            transition: opacity 0.3s;
        }

        .photo-item:hover .neon-border::after {
            opacity: 1;
        }

        /* 新增加载闪烁效果 */
        @keyframes twinkle {
            0% { opacity: 0.5; }
            50% { opacity: 1; }
            100% { opacity: 0.5; }
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>🌸 二次元幻想画廊 🌸</h1>
       
        <div class="photo-wall">
            <div class="photo-item">
                <img src="https://picsum.photos/300/400?random=1" alt="动漫图片" class="neon-border">
                <div class="photo-tag">魔法少女</div>
            </div>
           
            <div class="photo-item">
                <img src="https://picsum.photos/300/400?random=2" alt="动漫图片" class="neon-border">
                <div class="photo-tag">幻想世界</div>
            </div>
           
            <!-- 更多图片项 -->
        </div>
    </div>

    <!-- 新增装饰元素 -->
    <div class="anime-character">
        <img src="https://i.postimg.cc/8z6YqC4v/chibi.png" alt="Q版角色" style="width:100%">
    </div>

    <!-- 花瓣飘落效果 -->
    <div class="petal" style="left:5%;animation-duration:8s;animation-delay:-2s"></div>
    <div class="petal" style="left:15%;animation-duration:10s;animation-delay:-5s"></div>
    <div class="petal" style="left:30%;animation-duration:7s;animation-delay:0s"></div>
    <div class="petal" style="left:50%;animation-duration:9s;animation-delay:-3s"></div>

    <script>
        // 自动生成花瓣
        function createPetals() {
            const container = document.body;
            for(let i = 0; i < 15; i++) {
                const petal = document.createElement('div');
                petal.className = 'petal';
                petal.style.left = Math.random() * 100 + '%';
                petal.style.animationDuration = Math.random() * 3 + 5 + 's';
                petal.style.animationDelay = Math.random() * -10 + 's';
                petal.style.backgroundColor = `rgba(${Math.random()*255},${Math.random()*255},${Math.random()*255},0.7)`;
                container.appendChild(petal);
            }
        }
        createPetals();
    </script>
</body>
</html>