Professional Image Gallery - MeggiTools
Run
Toggle Theme
Share Link
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Professional Image Gallery</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css"> <style> body { font-family: 'Arial', sans-serif; background-color: #f0f0f0; margin: 0; padding: 20px; } .gallery { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; } .gallery-item { position: relative; overflow: hidden; cursor: pointer; transition: transform 0.3s ease; } .gallery-item:hover { transform: scale(1.05); } .gallery-item img { width: 100%; height: auto; display: block; border-radius: 10px; } .gallery-item .overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); opacity: 0; display: flex; justify-content: center; align-items: center; transition: opacity 0.3s ease; } .gallery-item:hover .overlay { opacity: 1; } .gallery-item .overlay .icon { color: #fff; font-size: 24px; margin: 0 10px; transition: transform 0.3s ease; } .gallery-item .overlay .icon:hover { transform: scale(1.2); } .lightbox { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); justify-content: center; align-items: center; z-index: 1000; } .lightbox img { max-width: 90%; max-height: 80%; border-radius: 10px; } .lightbox .close { position: absolute; top: 20px; right: 20px; color: #fff; font-size: 24px; cursor: pointer; } @keyframes slideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } .gallery-item { animation: slideIn 0.5s ease-in-out; } h1{ text-align: center; } </style> </head> <body> <h1>✨ Professional Image Gallery ✨</h1> <div class="gallery"> <div class="gallery-item"> <img src="https://via.placeholder.com/300" alt="Gallery Image 1"> <div class="overlay"> <i class="fas fa-search icon"></i> <i class="fas fa-heart icon"></i> </div> </div> <div class="gallery-item"> <img src="https://via.placeholder.com/300" alt="Gallery Image 2"> <div class="overlay"> <i class="fas fa-search icon"></i> <i class="fas fa-heart icon"></i> </div> </div> <div class="gallery-item"> <img src="https://via.placeholder.com/300" alt="Gallery Image 3"> <div class="overlay"> <i class="fas fa-search icon"></i> <i class="fas fa-heart icon"></i> </div> </div> <!-- Add more gallery items as needed --> </div> <div class="lightbox" id="lightbox"> <span class="close">×</span> <img src="" alt="Lightbox Image"> </div> <script> document.querySelectorAll('.gallery-item').forEach(item => { item.addEventListener('click', () => { const imgSrc = item.querySelector('img').getAttribute('src'); const lightbox = document.getElementById('lightbox'); lightbox.querySelector('img').setAttribute('src', imgSrc); lightbox.style.display = 'flex'; }); }); document.querySelector('.lightbox .close').addEventListener('click', () => { document.getElementById('lightbox').style.display = 'none'; }); document.addEventListener('keydown', (e) => { if (e.key === 'Escape') { document.getElementById('lightbox').style.display = 'none'; } }); </script> </body> </html>