0
点赞
收藏
分享

微信扫一扫

示例 16: 图像画廊展示

unadlib 2024-11-07 阅读 16

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Image Gallery</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            background-color: #f8f9fa;
        }
        .container {
            max-width: 1200px;
            margin: 20px auto;
            padding: 20px;
            background-color: white;
            border-radius: 8px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }
        .gallery {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }
        .gallery img {
            width: 100%;
            max-width: calc(33% - 10px);
            border-radius: 8px;
            transition: transform 0.3s ease;
        }
        .gallery img:hover {
            transform: scale(1.05);
        }
        @media (max-width: 768px) {
            .gallery img {
                max-width: calc(50% - 10px);
            }
        }
        @media (max-width: 480px) {
            .gallery img {
                max-width: 100%;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>Image Gallery</h1>
        <div class="gallery">
            <img src="https://via.placeholder.com/300" alt="Image 1">
            <img src="https://via.placeholder.com/300" alt="Image 2">
            <img src="https://via.placeholder.com/300" alt="Image 3">
            <img src="https://via.placeholder.com/300" alt="Image 4">
            <img src="https://via.placeholder.com/300" alt="Image 5">
            <img src="https://via.placeholder.com/300" alt="Image 6">
        </div>
    </div>
</body>
</html>

举报

相关推荐

0 条评论