Chic Masonry Grid - 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>Chic Masonry Grid</title> <style> body { font-family: 'Arial', sans-serif; margin: 0; padding: 0; background: #f7f7f7; } .masonry-grid { 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 #e67e22; } .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: #e67e22; transition: color 0.3s; } .masonry-item .content .icons i:hover { color: #d35400; } @media (max-width: 1200px) { .masonry-grid { column-count: 3; } } @media (max-width: 992px) { .masonry-grid { column-count: 2; } } @media (max-width: 768px) { .masonry-grid { 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-grid"> <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>