<!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: #f0f2f5;
}
.container {
max-width: 900px;
margin: 50px auto;
padding: 20px;
background-color: white;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
h1 {
color: #333;
text-align: center;
}
.gallery {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 15px;
}
.gallery img {
width: 100%;
height: auto;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.gallery img:hover {
opacity: 0.8;
}
</style>
</head>
<body>
<div class="container">
<h1>Image Gallery</h1>
<div class="gallery">
<img src="https://via.placeholder.com/200" alt="Image 1">
<img src="https://via.placeholder.com/200" alt="Image 2">
<img src="https://via.placeholder.com/200" alt="Image 3">
<img src="https://via.placeholder.com/200" alt="Image 4">
<img src="https://via.placeholder.com/200" alt="Image 5">
<img src="https://via.placeholder.com/200" alt="Image 6">
</div>
</div>
</body>
</html>
标签:box,示例,color,auto,30,5px,画廊,border,gallery
From: https://blog.51cto.com/u_16160172/12025951