Snippets Card

Bootstrap 5 Photo Grid List with Scroll and Layout Toggle

A scrollable photo grid with captions over a soft scrim and a Grid/List layout switch.

Bootstrap 5 No jQuery Oct 2019 2.5K views

<section class="wdw-stage">
  <div class="container" style="max-width: 960px;">
    <div class="wdw-card p-4 p-md-5" id="gridlist">
      <div class="d-flex flex-wrap align-items-end justify-content-between gap-3 mb-4">
        <div>
          <span class="wdw-eyebrow">October</span>
          <h2 class="wdw-heading h3 mb-0">Shared this month</h2>
        </div>
        <div class="btn-group" role="group" aria-label="Layout">
          <input type="radio" class="btn-check" name="gl-view" id="gl-grid" autocomplete="off" checked>
          <label class="btn btn-outline-primary rounded-start-pill px-4" for="gl-grid">Grid</label>
          <input type="radio" class="btn-check" name="gl-view" id="gl-list" autocomplete="off">
          <label class="btn btn-outline-primary rounded-end-pill px-4" for="gl-list">List</label>
        </div>
      </div>
      <div class="gl-scroll" tabindex="0" role="region" aria-label="Photo list">
        <div class="row g-3" id="gl-row">
        <div class="col-6 col-md-4 col-xl-3 gl-item">
          <a href="#" class="gl-tile d-block position-relative overflow-hidden rounded-4 text-decoration-none" aria-label="Forest morning by maya.k">
            <img src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?auto=format&fit=crop&w=500&q=70" alt="Forest morning" loading="lazy">
            <span class="gl-cap"><strong class="d-block">Forest morning</strong><small>by maya.k</small></span>
          </a>
        </div>
        <div class="col-6 col-md-4 col-xl-3 gl-item">
          <a href="#" class="gl-tile d-block position-relative overflow-hidden rounded-4 text-decoration-none" aria-label="Valley light by john99">
            <img src="https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=500&q=70" alt="Valley light" loading="lazy">
            <span class="gl-cap"><strong class="d-block">Valley light</strong><small>by john99</small></span>
          </a>
        </div>
        <div class="col-6 col-md-4 col-xl-3 gl-item">
          <a href="#" class="gl-tile d-block position-relative overflow-hidden rounded-4 text-decoration-none" aria-label="Golden hour by agnes19">
            <img src="https://images.unsplash.com/photo-1469474968028-56623f02e42e?auto=format&fit=crop&w=500&q=70" alt="Golden hour" loading="lazy">
            <span class="gl-cap"><strong class="d-block">Golden hour</strong><small>by agnes19</small></span>
          </a>
        </div>
        <div class="col-6 col-md-4 col-xl-3 gl-item">
          <a href="#" class="gl-tile d-block position-relative overflow-hidden rounded-4 text-decoration-none" aria-label="Misty pines by lena.r">
            <img src="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?auto=format&fit=crop&w=500&q=70" alt="Misty pines" loading="lazy">
            <span class="gl-cap"><strong class="d-block">Misty pines</strong><small>by lena.r</small></span>
          </a>
        </div>
        <div class="col-6 col-md-4 col-xl-3 gl-item">
          <a href="#" class="gl-tile d-block position-relative overflow-hidden rounded-4 text-decoration-none" aria-label="Lake reflection by tom_b">
            <img src="https://images.unsplash.com/photo-1501785888041-af3ef285b470?auto=format&fit=crop&w=500&q=70" alt="Lake reflection" loading="lazy">
            <span class="gl-cap"><strong class="d-block">Lake reflection</strong><small>by tom_b</small></span>
          </a>
        </div>
        <div class="col-6 col-md-4 col-xl-3 gl-item">
          <a href="#" class="gl-tile d-block position-relative overflow-hidden rounded-4 text-decoration-none" aria-label="Winter peaks by sara.v">
            <img src="https://images.unsplash.com/photo-1519681393784-d120267933ba?auto=format&fit=crop&w=500&q=70" alt="Winter peaks" loading="lazy">
            <span class="gl-cap"><strong class="d-block">Winter peaks</strong><small>by sara.v</small></span>
          </a>
        </div>
        <div class="col-6 col-md-4 col-xl-3 gl-item">
          <a href="#" class="gl-tile d-block position-relative overflow-hidden rounded-4 text-decoration-none" aria-label="Quiet shore by dan.o">
            <img src="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?auto=format&fit=crop&w=500&q=70" alt="Quiet shore" loading="lazy">
            <span class="gl-cap"><strong class="d-block">Quiet shore</strong><small>by dan.o</small></span>
          </a>
        </div>
        <div class="col-6 col-md-4 col-xl-3 gl-item">
          <a href="#" class="gl-tile d-block position-relative overflow-hidden rounded-4 text-decoration-none" aria-label="High ridge by ivy.s">
            <img src="https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?auto=format&fit=crop&w=500&q=70" alt="High ridge" loading="lazy">
            <span class="gl-cap"><strong class="d-block">High ridge</strong><small>by ivy.s</small></span>
          </a>
        </div>
        </div>
      </div>
    </div>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.

Free to use in personal and commercial projects under the MIT license.