Our Gallery
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.0"> <title>Red & Blue Gallery</title> </head> <body> <section class="gallery-section"> <div class="section-title"> <h2>Our Gallery</h2> </div> <div class="filter-buttons"> <button class="filter-btn active" data-filter="all">All</button> <button class="filter-btn" data-filter="red">Red Theme</button> <button class="filter-btn" data-filter="blue">Blue Theme</button> <button class="filter-btn" data-filter="mixed">Mixed</button> </div> <div class="gallery-grid"> <!-- Gallery Item 1 --> <div class="gallery-item" data-category="red"> <img src="https://images.unsplash.com/photo-1545205597-3d9d02c29597?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" alt="Red themed image"> <div class="gallery-item-overlay"> <h3>Red Passion</h3> <p>Vibrant red colors that evoke energy and passion</p> <a href="#" class="view-btn">View</a> </div> </div> <!-- Gallery Item 2 --> <div class="gallery-item" data-category="blue"> <img src="https://images.unsplash.com/photo-1571902943202-507ec2618e8f?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" alt="Blue themed image"> <div class="gallery-item-overlay"> <h3>Blue Serenity</h3> <p>Calming blue tones for peace and tranquility</p> <a href="#" class="view-btn">View</a> </div> </div> <!-- Gallery Item 3 --> <div class="gallery-item" data-category="mixed"> <img src="https://images.unsplash.com/photo-1581009137042-c552e485697a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" alt="Mixed themed image"> <div class="gallery-item-overlay"> <h3>Color Contrast</h3> <p>The dynamic combination of red and blue</p> <a href="#" class="view-btn">View</a> </div> </div> <!-- Gallery Item 4 --> <div class="gallery-item" data-category="red"> <img src="https://images.unsplash.com/photo-1607962837359-5e7e89f86776?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" alt="Red themed image"> <div class="gallery-item-overlay"> <h3>Red Abstract</h3> <p>Abstract compositions in bold red</p> <a href="#" class="view-btn">View</a> </div> </div> <!-- Gallery Item 5 --> <div class="gallery-item" data-category="blue"> <img src="https://images.unsplash.com/photo-1571019613454-1cb2f99b2d8b?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=800&q=80" alt="Blue themed image"> <div class="gallery-item-overlay"> <h3>Ocean Blue</h3> <p>The deep blue colors of the ocean</p> <a href="#" class="view-btn">View</a> </div> </div> <!-- Gallery Item 6 --> <div class="gallery-item" data-category="mixed"> <img src="https://source.unsplash.com/random/600x600/?red,blue,pattern" alt="Mixed themed image"> <div class="gallery-item-overlay"> <h3>Pattern Mix</h3> <p>Geometric patterns in red and blue</p> <a href="#" class="view-btn">View</a> </div> </div> <!-- Gallery Item 7 --> <div class="gallery-item" data-category="red"> <img src="https://source.unsplash.com/random/600x600/?red,flower" alt="Red themed image"> <div class="gallery-item-overlay"> <h3>Red Blooms</h3> <p>Beautiful red flowers in full bloom</p> <a href="#" class="view-btn">View</a> </div> </div> <!-- Gallery Item 8 --> <div class="gallery-item" data-category="blue"> <img src="https://source.unsplash.com/random/600x600/?blue,sky" alt="Blue themed image"> <div class="gallery-item-overlay"> <h3>Blue Skies</h3> <p>Expansive blue skies and clouds</p> <a href="#" class="view-btn">View</a> </div> </div> </div> </section> </body> </html>
CSS
/* Base Styles */ * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Arial', sans-serif; } body { background-color: #f5f5f5; } .gallery-section { padding: 60px 20px; max-width: 1200px; margin: 0 auto; } .section-title { text-align: center; margin-bottom: 40px; position: relative; } .section-title h2 { font-size: 2.5rem; color: #333; margin-bottom: 15px; } .section-title::after { content: ''; position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); width: 80px; height: 4px; background: linear-gradient(to right, #ff0000, #0000ff); } /* Gallery Grid */ .gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; } .gallery-item { position: relative; overflow: hidden; border-radius: 8px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); transition: all 0.3s ease; aspect-ratio: 1/1; } .gallery-item:hover { transform: translateY(-10px); box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2); } .gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s ease; } .gallery-item:hover img { transform: scale(1.1); } .gallery-item-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(135deg, rgba(255, 0, 0, 0.7), rgba(0, 0, 255, 0.7)); display: flex; flex-direction: column; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s ease; color: white; text-align: center; padding: 20px; } .gallery-item:hover .gallery-item-overlay { opacity: 1; } .gallery-item-overlay h3 { font-size: 1.5rem; margin-bottom: 10px; text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5); } .gallery-item-overlay p { font-size: 0.9rem; margin-bottom: 15px; } .view-btn { padding: 8px 20px; background-color: white; color: #333; border: none; border-radius: 30px; font-weight: bold; cursor: pointer; transition: all 0.3s ease; text-decoration: none; font-size: 0.9rem; } .view-btn:hover { background-color: #333; color: white; } /* Filter Buttons */ .filter-buttons { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; } .filter-btn { padding: 8px 20px; background-color: white; border: 2px solid #ddd; border-radius: 30px; cursor: pointer; transition: all 0.3s ease; font-weight: bold; } .filter-btn:hover, .filter-btn.active { background: linear-gradient(135deg, #ff0000, #0000ff); color: white; border-color: transparent; } /* Responsive Adjustments */ @media (max-width: 768px) { .section-title h2 { font-size: 2rem; } .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); } } @media (max-width: 480px) { .section-title h2 { font-size: 1.8rem; } .gallery-grid { grid-template-columns: 1fr 1fr; gap: 10px; } .filter-buttons { gap: 5px; } .filter-btn { padding: 6px 15px; font-size: 0.8rem; } }
JavaScript
// Simple filter functionality document.addEventListener('DOMContentLoaded', function() { const filterButtons = document.querySelectorAll('.filter-btn'); const galleryItems = document.querySelectorAll('.gallery-item'); filterButtons.forEach(button => { button.addEventListener('click', function() { // Update active button filterButtons.forEach(btn => btn.classList.remove('active')); this.classList.add('active'); const filterValue = this.getAttribute('data-filter'); // Filter items galleryItems.forEach(item => { if (filterValue === 'all' || item.getAttribute('data-category') === filterValue) { item.style.display = 'block'; } else { item.style.display = 'none'; } }); }); }); });
Output Preview
Desktop
Mobile
Fullscreen