Masonry Card Grid
A Pinterest-style masonry grid of varied-height cards, via Masonry.
Requires Bootstrap 5, Masonry. Add the CDN tags below to your page (styles in
<head>, scripts before </body>). The downloaded file already includes them.<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"><script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script><script src="https://cdn.jsdelivr.net/npm/masonry-layout@4.2.2/dist/masonry.pkgd.min.js"></script><div id="msGrid" style="width:380px;max-width:100%">
<div class="ms-item" style="width:48%"><div class="card border-0 shadow-sm mb-2"><div class="card-body" style="height:80px">Short</div></div></div>
<div class="ms-item" style="width:48%"><div class="card border-0 shadow-sm mb-2"><div class="card-body" style="height:140px">Tall card</div></div></div>
<div class="ms-item" style="width:48%"><div class="card border-0 shadow-sm mb-2"><div class="card-body" style="height:110px">Medium</div></div></div>
<div class="ms-item" style="width:48%"><div class="card border-0 shadow-sm mb-2"><div class="card-body" style="height:70px">Tiny</div></div></div>
</div>new Masonry('#msGrid',{itemSelector:'.ms-item',percentPosition:true,gutter:8});Free to use.This component uses Bootstrap 5, Masonry (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.