<div class="hex-gallery">
<div class="hex-row">
<div class="hex-card">
<img src="https://placehold.co/300x300/3b82f6/ffffff?text=Nature" alt="Image">
<div class="hex-overlay">Nature</div>
</div>
<div class="hex-card">
<img src="https://placehold.co/300x300/ec4899/ffffff?text=Urban" alt="Image">
<div class="hex-overlay">Urban</div>
</div>
<div class="hex-card">
<img src="https://placehold.co/300x300/10b981/ffffff?text=Tech" alt="Image">
<div class="hex-overlay">Tech</div>
</div>
</div>
<div class="hex-row offset-row">
<div class="hex-card">
<img src="https://placehold.co/300x300/f59e0b/ffffff?text=Space" alt="Image">
<div class="hex-overlay">Space</div>
</div>
<div class="hex-card">
<img src="https://placehold.co/300x300/8b5cf6/ffffff?text=Ocean" alt="Image">
<div class="hex-overlay">Ocean</div>
</div>
</div>
</div>
*, *::before, *::after {
box-sizing: border-box;
}
body {
font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
margin: 0;
background: #111827;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
padding: 40px 20px;
}
.hex-gallery {
display: flex;
flex-direction: column;
align-items: center;
}
.hex-row {
display: flex;
justify-content: center;
gap: 12px;
/* Pull rows together to interlock the hexagons */
margin-bottom: -56px;
}
.offset-row {
/* No offset needed horizontally because flex center aligns it perfectly */
}
.hex-card {
position: relative;
width: 200px;
height: 230px;
/* Perfect hexagon shape */
clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
background: #1e293b;
cursor: pointer;
transition: transform 0.3s ease;
}
.hex-card:hover {
transform: scale(1.05);
z-index: 10;
}
.hex-card img {
width: 100%;
height: 100%;
object-fit: cover;
transition: opacity 0.3s ease;
}
.hex-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(59, 130, 246, 0.8);
display: flex;
justify-content: center;
align-items: center;
color: #ffffff;
font-size: 1.5rem;
font-weight: 700;
opacity: 0;
transition: opacity 0.3s ease;
pointer-events: none;
}
.hex-card:hover .hex-overlay {
opacity: 1;
}
@media (max-width: 700px) {
.hex-card {
width: 140px;
height: 161px;
}
.hex-row {
gap: 8px;
margin-bottom: -40px;
}
.hex-overlay {
font-size: 1.125rem;
}
}