Snippets Card

Bootstrap 5 News Cards Grid with Category Filter

A responsive grid of news story cards with image, category badge, headline, excerpt and byline. Filter pills narrow the list by topic.

Bootstrap 5 No jQuery Jul 2019 2.4K views

<section class="wdw-stage">
  <div class="container w-100" style="max-width:1120px">
    <div class="d-flex flex-column flex-md-row justify-content-between align-items-md-end gap-3 mb-4">
      <div>
        <span class="wdw-eyebrow">Newsfeed</span>
        <h2 class="wdw-heading h2 mb-0">Latest in tech</h2>
      </div>
      <div class="d-flex flex-wrap gap-2" id="news-filters" role="group" aria-label="Filter stories">
        <button type="button" class="btn btn-sm btn-primary rounded-pill" data-filter="all" aria-pressed="true">All</button>
        <button type="button" class="btn btn-sm btn-outline-secondary rounded-pill" data-filter="Audio" aria-pressed="false">Audio</button>
        <button type="button" class="btn btn-sm btn-outline-secondary rounded-pill" data-filter="Camera" aria-pressed="false">Camera</button>
        <button type="button" class="btn btn-sm btn-outline-secondary rounded-pill" data-filter="Hardware" aria-pressed="false">Hardware</button>
        <button type="button" class="btn btn-sm btn-outline-secondary rounded-pill" data-filter="Laptops" aria-pressed="false">Laptops</button>
        <button type="button" class="btn btn-sm btn-outline-secondary rounded-pill" data-filter="Energy" aria-pressed="false">Energy</button>
      </div>
    </div>
    <div class="row row-cols-1 row-cols-sm-2 row-cols-lg-3 g-4" id="news-grid">
      <div class="col" data-cat="Camera">
        <article class="card news-card h-100 border-0 wdw-card-sm overflow-hidden">
          <div class="ratio ratio-16x9 overflow-hidden"><img src="https://images.unsplash.com/photo-1516035069371-29a1b244cc32?auto=format&fit=crop&w=720&q=70" alt="" loading="lazy" class="object-fit-cover"></div>
          <div class="card-body p-4 d-flex flex-column">
            <span class="badge rounded-pill bg-primary-subtle text-primary-emphasis align-self-start mb-3">Camera</span>
            <h3 class="h5 fw-bold mb-2"><a href="#" class="stretched-link text-body-emphasis text-decoration-none">Canon unveils a compact servo telephoto zoom</a></h3>
            <p class="text-body-secondary small mb-3">A new 70-200mm lens brings smooth, quiet zoom to run-and-gun shooters and small crews.</p>
            <p class="small text-body-secondary mt-auto mb-0">Maya Chen · 3 mins ago</p>
          </div>
        </article>
      </div>
      <div class="col" data-cat="Audio">
        <article class="card news-card h-100 border-0 wdw-card-sm overflow-hidden">
          <div class="ratio ratio-16x9 overflow-hidden"><img src="https://images.unsplash.com/photo-1505740420928-5e560c06d30e?auto=format&fit=crop&w=720&q=70" alt="" loading="lazy" class="object-fit-cover"></div>
          <div class="card-body p-4 d-flex flex-column">
            <span class="badge rounded-pill bg-primary-subtle text-primary-emphasis align-self-start mb-3">Audio</span>
            <h3 class="h5 fw-bold mb-2"><a href="#" class="stretched-link text-body-emphasis text-decoration-none">Sennheiser HD 598 specs, tested and explained</a></h3>
            <p class="text-body-secondary small mb-3">Open-back comfort and a warm, wide soundstage: what the numbers say and what you will hear.</p>
            <p class="small text-body-secondary mt-auto mb-0">Leo Park · 1 hour ago</p>
          </div>
        </article>
      </div>
      <div class="col" data-cat="Energy">
        <article class="card news-card h-100 border-0 wdw-card-sm overflow-hidden">
          <div class="ratio ratio-16x9 overflow-hidden"><img src="https://images.unsplash.com/photo-1466611653911-95081537e5b7?auto=format&fit=crop&w=720&q=70" alt="" loading="lazy" class="object-fit-cover"></div>
          <div class="card-body p-4 d-flex flex-column">
            <span class="badge rounded-pill bg-primary-subtle text-primary-emphasis align-self-start mb-3">Energy</span>
            <h3 class="h5 fw-bold mb-2"><a href="#" class="stretched-link text-body-emphasis text-decoration-none">North Sea wind hub is set to power millions of homes</a></h3>
            <p class="text-body-secondary small mb-3">Offshore turbines and an artificial island will link several countries to one shared grid.</p>
            <p class="small text-body-secondary mt-auto mb-0">Sara Novak · 3 hours ago</p>
          </div>
        </article>
      </div>
      <div class="col" data-cat="Laptops">
        <article class="card news-card h-100 border-0 wdw-card-sm overflow-hidden">
          <div class="ratio ratio-16x9 overflow-hidden"><img src="https://images.unsplash.com/photo-1498050108023-c5249f4df085?auto=format&fit=crop&w=720&q=70" alt="" loading="lazy" class="object-fit-cover"></div>
          <div class="card-body p-4 d-flex flex-column">
            <span class="badge rounded-pill bg-primary-subtle text-primary-emphasis align-self-start mb-3">Laptops</span>
            <h3 class="h5 fw-bold mb-2"><a href="#" class="stretched-link text-body-emphasis text-decoration-none">Why the thin-and-light laptop is finally fast enough</a></h3>
            <p class="text-body-secondary small mb-3">Efficient chips and better cooling have closed the gap with bulkier workstations.</p>
            <p class="small text-body-secondary mt-auto mb-0">Jon Ellis · Yesterday</p>
          </div>
        </article>
      </div>
      <div class="col" data-cat="Hardware">
        <article class="card news-card h-100 border-0 wdw-card-sm overflow-hidden">
          <div class="ratio ratio-16x9 overflow-hidden"><img src="https://images.unsplash.com/photo-1518770660439-4636190af475?auto=format&fit=crop&w=720&q=70" alt="" loading="lazy" class="object-fit-cover"></div>
          <div class="card-body p-4 d-flex flex-column">
            <span class="badge rounded-pill bg-primary-subtle text-primary-emphasis align-self-start mb-3">Hardware</span>
            <h3 class="h5 fw-bold mb-2"><a href="#" class="stretched-link text-body-emphasis text-decoration-none">Inside the next generation of low-power chips</a></h3>
            <p class="text-body-secondary small mb-3">Smaller nodes, stacked memory and smarter scheduling are changing what a watt can do.</p>
            <p class="small text-body-secondary mt-auto mb-0">Maya Chen · Yesterday</p>
          </div>
        </article>
      </div>
      <div class="col" data-cat="Audio">
        <article class="card news-card h-100 border-0 wdw-card-sm overflow-hidden">
          <div class="ratio ratio-16x9 overflow-hidden"><img src="https://images.unsplash.com/photo-1583394838336-acd977736f90?auto=format&fit=crop&w=720&q=70" alt="" loading="lazy" class="object-fit-cover"></div>
          <div class="card-body p-4 d-flex flex-column">
            <span class="badge rounded-pill bg-primary-subtle text-primary-emphasis align-self-start mb-3">Audio</span>
            <h3 class="h5 fw-bold mb-2"><a href="#" class="stretched-link text-body-emphasis text-decoration-none">Studio headphones that finally break the mould</a></h3>
            <p class="text-body-secondary small mb-3">A fresh take on closed-back design, built for long sessions and fast travel.</p>
            <p class="small text-body-secondary mt-auto mb-0">Leo Park · 2 days ago</p>
          </div>
        </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.