<!DOCTYPE html><htmllang="en"data-bs-theme="auto"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1"><metaname="description"content=""><metaname="author"content="Mark Otto, Jacob Thornton, and Bootstrap contributors"><metaname="generator"content="Astro v5.6.1"><title>Masonry example · Bootstrap v5.3</title><linkrel="canonical"href="https://getbootstrap.com/docs/5.3/examples/masonry/"><scriptsrc="/docs/5.3/assets/js/color-modes.js"></script><linkrel="stylesheet"href="https://cdn.jsdelivr.net/npm/@docsearch/css@3"><linkhref="/docs/5.3/dist/css/bootstrap.min.css"rel="stylesheet"integrity="sha384-SgOJa3DmI69IUzQ2PVdRZhwQ+dy64/BUtbMJw1MZ8t5HZApcHrRKUc4W0kG879m7"><linkrel="apple-touch-icon"href="/docs/5.3/assets/img/favicons/apple-touch-icon.png"sizes="180x180"><linkrel="icon"href="/docs/5.3/assets/img/favicons/favicon-32x32.png"sizes="32x32"type="image/png"><linkrel="icon"href="/docs/5.3/assets/img/favicons/favicon-16x16.png"sizes="16x16"type="image/png"><linkrel="manifest"href="/docs/5.3/assets/img/favicons/manifest.json"><linkrel="mask-icon"href="/docs/5.3/assets/img/favicons/safari-pinned-tab.svg"color="#712cf9"><linkrel="icon"href="/docs/5.3/assets/img/favicons/favicon.ico"><metaname="theme-color"content="#712cf9"><style>.bd-placeholder-img{font-size:1.125rem;text-anchor:middle;-webkit-user-select:none;-moz-user-select:none;user-select:none}@media(min-width:768px){.bd-placeholder-img-lg{font-size:3.5rem}}.b-example-divider{width:100%;height:3rem;background-color:#0000001a;border:solidrgba(0,0,0,.15);border-width:1px0;box-shadow:inset0.5em1.5em#0000001a,inset0.125em.5em#00000026}.b-example-vr{flex-shrink:0;width:1.5rem;height:100vh}.bi{vertical-align:-.125em;fill:currentColor}.nav-scroller{position:relative;z-index:2;height:2.75rem;overflow-y:hidden}.nav-scroller.nav{display:flex;flex-wrap:nowrap;padding-bottom:1rem;margin-top:-1px;overflow-x:auto;text-align:center;white-space:nowrap;-webkit-overflow-scrolling:touch}.btn-bd-primary{--bd-violet-bg:#712cf9;--bd-violet-rgb:112.520718,44.062154,249.437846;--bs-btn-font-weight:600;--bs-btn-color:var(--bs-white);--bs-btn-bg:var(--bd-violet-bg);--bs-btn-border-color:var(--bd-violet-bg);--bs-btn-hover-color:var(--bs-white);--bs-btn-hover-bg:#6528e0;--bs-btn-hover-border-color:#6528e0;--bs-btn-focus-shadow-rgb:var(--bd-violet-rgb);--bs-btn-active-color:var(--bs-btn-hover-color);--bs-btn-active-bg:#5a23c8;--bs-btn-active-border-color:#5a23c8}.bd-mode-toggle{z-index:1500}.bd-mode-toggle.bi{width:1em;height:1em}.bd-mode-toggle.dropdown-menu.active.bi{display:block!important}
<svgclass="bi ms-auto d-none"aria-hidden="true"><usehref="#check2"></use></svg></button></li></ul></div><mainclass="container py-5"><h1>Bootstrap and Masonry</h1><pclass="lead">Integrate <ahref="https://masonry.desandro.com/">Masonry</a> with the Bootstrap grid system and cards component.</p><p>Masonry is not included in Bootstrap. Add it by including the JavaScript plugin manually, or using a CDN like so:</p><pre><code>
</code></pre><p>By adding <code>data-masonry='}"percentPosition": true }'</code> to the <code>.row</code> wrapper, we can combine the powers of Bootstrap's responsive grid and Masonry's positioning.</p><hrclass="my-5"><divclass="row"data-masonry="{"percentPosition": true }"><divclass="col-sm-6 col-lg-4 mb-4"><divclass="card"><svgaria-label="Placeholder: Image cap"class="bd-placeholder-img card-img-top"height="200"preserveAspectRatio="xMidYMid slice"role="img"width="100%"xmlns="http://www.w3.org/2000/svg"><title>Placeholder</title><rectwidth="100%"height="100%"fill="#868e96"></rect><textx="50%"y="50%"fill="#dee2e6"dy=".3em">Image cap</text></svg><divclass="card-body"><h5class="card-title">Card title that wraps to a new line</h5><pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p></div></div></div><divclass="col-sm-6 col-lg-4 mb-4"><divclass="card p-3"><figureclass="p-3 mb-0"><blockquoteclass="blockquote"><p>A well-known quote, contained in a blockquote element.</p></blockquote><figcaptionclass="blockquote-footer mb-0 text-body-secondary">
Someone famous in <citetitle="Source Title">Source Title</cite></figcaption></figure></div></div><divclass="col-sm-6 col-lg-4 mb-4"><divclass="card"><svgaria-label="Placeholder: Image cap"class="bd-placeholder-img card-img-top"height="200"preserveAspectRatio="xMidYMid slice"role="img"width="100%"xmlns="http://www.w3.org/2000/svg"><title>Placeholder</title><rectwidth="100%"height="100%"fill="#868e96"></rect><textx="50%"y="50%"fill="#dee2e6"dy=".3em">Image cap</text></svg><divclass="card-body"><h5class="card-title">Card title</h5><pclass="card-text">This card has supporting text below as a natural lead-in to additional content.</p><pclass="card-text"><smallclass="text-body-secondary">Last updated 3 mins ago</small></p></div></div></div><divclass="col-sm-6 col-lg-4 mb-4"><divclass="card text-bg-primary text-center p-3"><figureclass="mb-0"><blockquoteclass="blockquote"><p>A well-known quote, contained in a blockquote element.</p></blockquote><figcaptionclass="blockquote-footer mb-0 text-white">
Someone famous in <citetitle="Source Title">Source Title</cite></figcaption></figure></div></div><divclass="col-sm-6 col-lg-4 mb-4"><divclass="card text-center"><divclass="card-body"><h5class="card-title">Card title</h5><pclass="card-text">This card has a regular title and short paragraph of text below it.</p><pclass="card-text"><smallclass="text-body-secondary">Last updated 3 mins ago</small></p></div></div></div><divclass="col-sm-6 col-lg-4 mb-4"><divclass="card"><svgaria-label="Placeholder: Card image"class="bd-placeholder-img card-img"height="260"preserveAspectRatio="xMidYMid slice"role="img"width="100%"xmlns="http://www.w3.org/2000/svg"><title>Placeholder</title><rectwidth="100%"height="100%"fill="#868e96"></rect><textx="50%"y="50%"fill="#dee2e6"dy=".3em">Card image</text></svg></div></div><divclass="col-sm-6 col-lg-4 mb-4"><divclass="card p-3 text-end"><figureclass="mb-0"><blockquoteclass="blockquote"><p>A well-known quote, contained in a blockquote element.</p></blockquote><figcaptionclass="blockquote-footer mb-0 text-body-secondary">
Someone famous in <citetitle="Source Title">Source Title</cite></figcaption></figure></div></div><divclass="col-sm-6 col-lg-4 mb-4"><divclass="card"><divclass="card-body"><h5class="card-title">Card title</h5><pclass="card-text">This is another card with title and supporting text below. This card has some additional content to make it slightly taller overall.</p><pclass="card-text"><smallclass="text-body-secondary">Last updated 3 mins ago</small></p></div></div></div></div></main><scriptsrc="/docs/5.3/dist/js/bootstrap.bundle.min.js"integrity="sha384-k6d4wzSIapyDyv1kpU366/PK5hCdSbCRGRCMv+eplOQJWyd1fbcAu9OCUj5zNLiq"class="astro-vvvwv3sm"></script><scriptasyncsrc="https://cdn.jsdelivr.net/npm/masonry-layout@4.2.2/dist/masonry.pkgd.min.js"integrity="sha384-GNFwBvfVxBkLMJpYMOABq3c+d3KnQxudP/mGPkzpZSTYykLBNsZEnG2D9G/X/+7D"crossorigin="anonymous"class="astro-vvvwv3sm"></script></body></html>