DevPlatform
Home
Components
Search
Submit
Earn
Login
Sign Up Free
Hexa Gallery - Preview | DevPlatform
DevPlatform
Categories
Accordion
Animation
Box Shadow
Button
Card
Footer
Form
Gallery
Hero Section
Inputs
Loader
Marquee
Modal
Modules
Navbar
Progress Bar
Radio Buttons
Search-Bar
Sections
Slider
Tab
Timeline
Toggle
Hexa Gallery
sachin007
Jan 17, 2026
8
0
Share
Live Preview
Refresh
Live Editor
HTML
CSS
JS
HTML
CSS
JavaScript
1
<h2>Hexagon Image Gallery</h2> <div class="hex-collage"> <div class="hex-item"> <img src="https://picsum.photos/id/1015/400/400" alt="Nature"> <div class="hex-caption">Mountain Lake</div> </div> <div class="hex-item"> <img src="https://picsum.photos/id/1018/400/400" alt="Forest"> <div class="hex-caption">Misty Woods</div> </div> <div class="hex-item"> <img src="https://picsum.photos/id/1022/400/400" alt="Autumn"> <div class="hex-caption">Golden Leaves</div> </div> <div class="hex-item"> <img src="https://picsum.photos/id/1039/400/400" alt="City"> <div class="hex-caption">Urban Skyline</div> </div> <div class="hex-item"> <img src="https://picsum.photos/id/1040/400/400" alt="Street"> <div class="hex-caption">City Life</div> </div> <div class="hex-item"> <img src="https://picsum.photos/id/1015/400/400" alt="Nature"> <div class="hex-caption">Mountain Lake</div> </div> <div class="hex-item"> <img src="https://picsum.photos/id/1018/400/400" alt="Forest"> <div class="hex-caption">Misty Woods</div> </div> <div class="hex-item"> <img src="https://picsum.photos/id/1062/400/400" alt="Desert"> <div class="hex-caption">Desert Dunes</div> </div> </div>
1
* { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Inter', sans-serif; background: #f8fafc; padding: 40px 20px; min-height: 100vh; display: flex; flex-direction: column; align-items: center; } h2 { text-align: center; font-size: 2.2rem; margin-bottom: 30px; color: #1e293b; letter-spacing: -0.5px; } .hex-collage { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 32px; max-width: 900px; justify-items: center; } .hex-item { width: 160px; height: 160px; position: relative; transition: transform 0.3s ease, filter 0.3s ease; } .hex-item:hover { transform: scale(1.08); z-index: 2; } .hex-item img { width: 100%; height: 100%; object-fit: cover; /* Create hexagon using clip-path */ clip-path: polygon( 50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25% ); transition: transform 0.4s ease; } .hex-item:hover img { transform: scale(1.1); } /* Optional: Add subtle shadow on hover */ .hex-item::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.1); clip-path: polygon( 50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25% ); opacity: 0; transition: opacity 0.3s ease; pointer-events: none; } .hex-item:hover::before { opacity: 1; } /* Caption below hexagon (optional) */ .hex-caption { margin-top: 12px; font-size: 0.85rem; color: #475569; text-align: center; max-width: 160px; line-height: 1.4; } /* Responsive: Larger on desktop */ @media (min-width: 768px) { .hex-collage { grid-template-columns: repeat(4, 1fr); gap: 40px; } .hex-item { width: 180px; height: 180px; } } @media (min-width: 1024px) { .hex-item { width: 200px; height: 200px; } }
1
Comments
0
Want to comment?
Please
login
or
sign up
to post comments.
No comments yet
Be the first to comment on this component!
Comments 0
Want to comment?
Please login or sign up to post comments.
No comments yet
Be the first to comment on this component!