Responsive Animated Gallery Section
Preview
Edit
Download
Run
Download Options
HTML File
Download as .html file
CSS File
Download as .css file
JavaScript File
Download as .js file
Combined HTML
All code in one HTML file
Project ZIP
All files in a ZIP archive
Cancel
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Responsive Animated Gallery</title> </head> <body> <div class="gallery-container"> <h2>Our Stunning <span> Gallery</span></h2> <div class="gallery-grid"> <div class="gallery-item"> <img src="https://images.unsplash.com/photo-1755366282248-ebe47a7b33b4?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxmZWF0dXJlZC1waG90b3MtZmVlZHwxMXx8fGVufDB8fHx8fA%3D%3D" alt="Image 1" /> <div class="overlay">Beautiful Landscape 1</div> </div> <div class="gallery-item"> <img src="https://images.unsplash.com/photo-1757778281745-85a04487b859?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHx0b3BpYy1mZWVkfDR8NnNNVmpUTFNrZVF8fGVufDB8fHx8fA%3D%3D" alt="Image 2" /> <div class="overlay">Beautiful Landscape 2</div> </div> <div class="gallery-item"> <img src="https://plus.unsplash.com/premium_photo-1755606533194-a6280b358083?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHx0b3BpYy1mZWVkfDV8NnNNVmpUTFNrZVF8fGVufDB8fHx8fA%3D%3D" alt="Image 3" /> <div class="overlay">Beautiful Landscape 3</div> </div> <div class="gallery-item"> <img src="https://plus.unsplash.com/premium_photo-1757872132643-d1b26b1b4be6?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHx0b3BpYy1mZWVkfDM2fDZzTVZqVExTa2VRfHxlbnwwfHx8fHw%3D" alt="Image 4" /> <div class="overlay">Beautiful Landscape 4</div> </div> <div class="gallery-item"> <img src="https://plus.unsplash.com/premium_photo-1668456012219-e3299fd0307e?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHx0b3BpYy1mZWVkfDQwfDZzTVZqVExTa2VRfHxlbnwwfHx8fHw%3D" alt="Image 5" /> <div class="overlay">Beautiful Landscape 5</div> </div> <div class="gallery-item"> <img src="https://images.unsplash.com/photo-1757789325996-9a6e63b2bd0e?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHx0b3BpYy1mZWVkfDQyfDZzTVZqVExTa2VRfHxlbnwwfHx8fHw%3D" alt="Image 6" /> <div class="overlay">Beautiful Landscape 6</div> </div> <div class="gallery-item"> <img src="https://images.unsplash.com/photo-1755366282248-ebe47a7b33b4?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxmZWF0dXJlZC1waG90b3MtZmVlZHwxMXx8fGVufDB8fHx8fA%3D%3D" alt="Image 1" /> <div class="overlay">Beautiful Landscape 7</div> </div> <div class="gallery-item"> <img src="https://plus.unsplash.com/premium_photo-1668456012219-e3299fd0307e?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHx0b3BpYy1mZWVkfDQwfDZzTVZqVExTa2VRfHxlbnwwfHx8fHw%3D" alt="Image 5" /> <div class="overlay">Beautiful Landscape 8</div> </div> </div> </div> </body> </html>
CSS
* { box-sizing: border-box; margin: 0; padding: 0; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f5f5f5; padding: 40px 20px; display: flex; justify-content: center; } .gallery-container { max-width: 1200px; width: 100%; } h2 { font-size: 40px; text-align: center; margin-bottom: 30px; color: #333; font-weight: 700; } h2 span { color: blue; } .gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; } .gallery-item { position: relative; overflow: hidden; border-radius: 10px; box-shadow: 0 8px 14px rgba(0,0,0,0.1); cursor: pointer; background: white; transform: translateY(20px); opacity: 0; animation: fadeInUp 0.6s forwards ease-out; } /* stagger animations */ .gallery-item:nth-child(1) { animation-delay: 0s; } .gallery-item:nth-child(2) { animation-delay: 0.15s; } .gallery-item:nth-child(3) { animation-delay: 0.3s; } .gallery-item:nth-child(4) { animation-delay: 0.45s; } .gallery-item:nth-child(5) { animation-delay: 0.6s; } .gallery-item:nth-child(6) { animation-delay: 0.75s; } @keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } } .gallery-item img { width: 100%; height: auto; display: block; transition: transform 0.4s ease; } .gallery-item:hover img { transform: scale(1.1); } .gallery-item .overlay { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0, 0, 0, 0.818); color: rgb(242, 255, 1); padding: 10px 15px; font-size: 1rem; opacity: 0; transform: translateY(100%); transition: opacity 0.3s ease, transform 0.3s ease; border-radius: 0 0 10px 10px; } .gallery-item:hover .overlay { opacity: 1; transform: translateY(0); } @media (max-width: 600px) { h2 { font-size: 1.5rem; } }
JavaScript
Output Preview
Desktop
Mobile
Fullscreen