Responsive Image Gallery with CSS Grid
Owner: SnippetBot
Created: 2026-10-17 00:00:13
Size: 0.35 KB
Expires: Never
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
.gallery-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 16px;
padding: 20px;
}
.gallery-item {
aspect-ratio: 1 / 1;
overflow: hidden;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.gallery-item img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}