Snippets Card

Bootstrap 5 Cards with Images: Cap, Overlay and Tabs

A set of Bootstrap 5 card variations built around imagery: image cap with badge and footer, gradient image overlay, accent panel, tabbed pill header and list group card.

Bootstrap 5 No jQuery Jul 2019 2K views

<section class="wdw-stage">
  <div class="container" style="max-width:1100px">
    <div class="mb-4">
      <span class="wdw-eyebrow">Components</span>
      <h2 class="wdw-heading h2 mb-0">Card layouts with images</h2>
    </div>
    <div class="row g-4">
      <div class="col-md-6 col-lg-4">
        <article class="card wdw-card h-100 overflow-hidden">
          <img src="https://images.unsplash.com/photo-1506744038136-46273834b3fb?auto=format&fit=crop&w=800&q=70" class="card-img-top cd-img" alt="Mountain valley under a bright sky">
          <div class="card-body p-4">
            <span class="badge rounded-pill text-bg-primary mb-2">Travel</span>
            <h3 class="h5 fw-bold text-body-emphasis">Into the valley</h3>
            <p class="card-text text-body-secondary">An image cap card with a badge, title and short description for blog or listing grids.</p>
          </div>
          <div class="card-footer bg-transparent border-top-0 px-4 pb-4 pt-0 d-flex align-items-center justify-content-between">
            <small class="text-body-secondary">6 min read</small>
            <a href="#" class="link-primary fw-semibold text-decoration-none">Read more →</a>
          </div>
        </article>
      </div>
      <div class="col-md-6 col-lg-4 d-flex flex-column gap-4">
        <article class="card wdw-card cd-overlay flex-grow-1 border-0 text-white overflow-hidden">
          <img src="https://images.unsplash.com/photo-1469474968028-56623f02e42e?auto=format&fit=crop&w=800&q=70" class="card-img cd-img-fill" alt="Sunrise over rolling hills">
          <div class="card-img-overlay cd-scrim d-flex flex-column justify-content-end p-4">
            <h3 class="h5 fw-bold mb-1">Image overlay</h3>
            <p class="card-text small mb-0 opacity-75">Text sits on a gradient scrim so it stays readable.</p>
          </div>
        </article>
        <article class="card wdw-card wdw-aurora border-0 text-center p-4">
          <h3 class="h5 fw-bold mb-1">Accent card</h3>
          <p class="small mb-3 opacity-75">A bold brand panel for calls to action.</p>
          <a href="#" class="btn btn-light rounded-pill align-self-center px-4">Get started</a>
        </article>
      </div>
      <div class="col-md-12 col-lg-4 d-flex flex-column gap-4">
        <article class="card wdw-card overflow-hidden">
          <div class="card-header bg-transparent border-0 pt-3 px-3">
            <ul class="nav nav-pills gap-1" role="tablist">
              <li class="nav-item" role="presentation"><button class="nav-link active rounded-pill px-3 py-1" data-bs-toggle="pill" data-bs-target="#cd-tab-1" type="button" role="tab" aria-selected="true">Overview</button></li>
              <li class="nav-item" role="presentation"><button class="nav-link rounded-pill px-3 py-1" data-bs-toggle="pill" data-bs-target="#cd-tab-2" type="button" role="tab" aria-selected="false" tabindex="-1">Details</button></li>
            </ul>
          </div>
          <div class="tab-content">
            <div class="tab-pane fade show active" id="cd-tab-1" role="tabpanel">
              <img src="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?auto=format&fit=crop&w=800&q=70" class="cd-img-sm w-100" alt="Sunlit forest path">
              <div class="p-4"><h3 class="h6 fw-bold text-body-emphasis">Tabbed header</h3><p class="small text-body-secondary mb-0">Pills in the header switch the card content.</p></div>
            </div>
            <div class="tab-pane fade" id="cd-tab-2" role="tabpanel">
              <img src="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?auto=format&fit=crop&w=800&q=70" class="cd-img-sm w-100" alt="Misty forest at dawn">
              <div class="p-4"><h3 class="h6 fw-bold text-body-emphasis">More details</h3><p class="small text-body-secondary mb-0">Each pane can hold its own image and copy.</p></div>
            </div>
          </div>
        </article>
        <article class="card wdw-card">
          <div class="card-body p-4 pb-2"><h3 class="h6 fw-bold text-body-emphasis mb-0">Checklist</h3></div>
          <ul class="list-group list-group-flush rounded-bottom-4">
            <li class="list-group-item d-flex justify-content-between align-items-center px-4 py-3">Design tokens <span class="badge bg-success-subtle text-success-emphasis rounded-pill">Done</span></li>
            <li class="list-group-item d-flex justify-content-between align-items-center px-4 py-3">Component audit <span class="badge bg-primary-subtle text-primary-emphasis rounded-pill">In progress</span></li>
            <li class="list-group-item d-flex justify-content-between align-items-center px-4 py-3">Launch review <span class="badge bg-body-secondary text-body-secondary rounded-pill">Queued</span></li>
          </ul>
        </article>
      </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.