Unique Masonry Layout - 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>Unique Masonry Layout</title> <style> body { font-family: 'Arial', sans-serif; margin: 0; padding: 0; background: #f0f0f0; } .masonry { column-count: 4; column-gap: 1em; padding: 1em; max-width: 1200px; margin: auto; } .masonry-item { background: #fff; display: inline-block; margin: 0 0 1em; width: 100%; border-radius: 10px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); transition: transform 0.3s, box-shadow 0.3s; overflow: hidden; } .masonry-item:hover { transform: translateY(-10px); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); } .masonry-item img { width: 100%; border-bottom: 5px solid #ff6347; } .masonry-item .content { padding: 1em; text-align: center; } .masonry-item .content h3 { margin: 0.5em 0; font-size: 1.5em; } .masonry-item .content p { color: #777; font-size: 1em; } .masonry-item .content .icons { margin-top: 0.5em; } .masonry-item .content .icons i { font-size: 1.2em; margin: 0 0.5em; color: #ff6347; transition: color 0.3s; } .masonry-item .content .icons i:hover { color: #ff4500; } @media (max-width: 1200px) { .masonry { column-count: 3; } } @media (max-width: 992px) { .masonry { column-count: 2; } } @media (max-width: 768px) { .masonry { column-count: 1; } } </style> <script> document.addEventListener('DOMContentLoaded', function () { const items = document.querySelectorAll('.masonry-item'); items.forEach((item, index) => { const delay = index * 100; item.style.transitionDelay = `${delay}ms`; }); }); </script> </head> <body> <div class="masonry"> <div class="masonry-item"> <img src="https://via.placeholder.com/300x200" alt="Image 1"> <div class="content"> <h3>Item 1</h3> <p>Here is some description. 📝</p> <div class="icons"> <i class="fa fa-heart"></i> <i class="fa fa-share"></i> <i class="fa fa-comment"></i> </div> </div> </div> <div class="masonry-item"> <img src="https://via.placeholder.com/300x200" alt="Image 2"> <div class="content"> <h3>Item 2</h3> <p>Here is some description. 🌟</p> <div class="icons"> <i class="fa fa-heart"></i> <i class="fa fa-share"></i> <i class="fa fa-comment"></i> </div> </div> </div> <div class="masonry-item"> <img src="https://via.placeholder.com/300x200" alt="Image 3"> <div class="content"> <h3>Item 3</h3> <p>Here is some description. 🚀</p> <div class="icons"> <i class="fa fa-heart"></i> <i class="fa fa-share"></i> <i class="fa fa-comment"></i> </div> </div> </div> <!-- Add more items as needed --> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/js/all.min.js"></script> </body> </html>