Class 22 of 48 • Core Components

Bootstrap 5 Cards: Architecture, Images & Responsive Grid Layouts

The Card is one of the most versatile and ubiquitous UI containers in modern web design. Introduced in Bootstrap 4 to replace legacy panels, wells, and thumbnails, a card provides a flexible, extensible content container with headers, footers, images, and contextual backgrounds built on CSS Flexbox.

Bootstrap 5 Card Architecture: Header, Image, Body, and Footer
Figure 22: Card container anatomy: header bar, full-bleed cap image, padded card body with action links, and muted footer.

1. Anatomical Structure of a Bootstrap Card

A standard card consists of a bordered container holding an optional top image, card header, card body, and footer:

<div class="card shadow-sm" style="max-width: 22rem;">
  <!-- Optional Top Image -->
  <img src="images/bootstrap-5-architecture.svg" class="card-img-top" alt="Course Banner">

  <!-- Card Header -->
  <div class="card-header bg-white fw-bold">
    Featured Tutorial Module
  </div>

  <!-- Card Body -->
  <div class="card-body">
    <h5 class="card-title text-primary">Bootstrap 5 Masterclass</h5>
    <h6 class="card-subtitle mb-2 text-body-secondary">Class 22 of 48</h6>
    <p class="card-text text-secondary">
      Learn how to structure flexible card decks, format top images, and embed action buttons.
    </p>
    <a href="#" class="btn btn-primary">Start Reading &rarr;</a>
  </div>

  <!-- Card Footer -->
  <div class="card-footer text-body-secondary text-end">
    Last updated: Today
  </div>
</div>

2. Responsive Card Grids (.row-cols-*)

To arrange cards into a responsive grid (e.g. 1 column on phones, 2 columns on tablets, and 3 columns on desktops) with equal height cards, combine .row-cols-* with .h-100:

<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-4">
  <!-- Card 1 -->
  <div class="col">
    <div class="card h-100 shadow-sm">
      <div class="card-body">
        <h5 class="card-title">Card One</h5>
        <p class="card-text">Equal height card using the .h-100 class.</p>
      </div>
      <div class="card-footer"><small class="text-muted">Footer 1</small></div>
    </div>
  </div>

  <!-- Card 2 -->
  <div class="col">
    <div class="card h-100 shadow-sm">
      <div class="card-body">
        <h5 class="card-title">Card Two</h5>
        <p class="card-text">Content automatically aligns footers to the very bottom!</p>
      </div>
      <div class="card-footer"><small class="text-muted">Footer 2</small></div>
    </div>
  </div>
</div>

3. Horizontal Card Layout (Media Object Pattern)

Create modern blog list items or product catalog cards by placing an image on the left and text on the right using a nested row:

<div class="card mb-3 shadow-sm" style="max-width: 540px;">
  <div class="row g-0">
    <div class="col-md-4">
      <img src="images/logo.png" class="img-fluid rounded-start p-3" alt="Logo">
    </div>
    <div class="col-md-8">
      <div class="card-body">
        <h5 class="card-title">Horizontal Card</h5>
        <p class="card-text">Image on the left side, text on the right side on desktop.</p>
      </div>
    </div>
  </div>
</div>

Explore Related Bootstrap Tutorials & Next Steps

Strengthen your responsive web design mastery by studying these connected classes:

Grid System for Card Decks

Arrange cards into responsive 1, 2, 3, and 4-column desktop layouts.

Card Images (.card-img-top)

Add responsive header images, cap graphics, and full background overlays.

Card Action Buttons

Add call-to-action buttons, links, and button groups inside card bodies.

Cards in Dark Theme

Style card backgrounds and borders automatically using color mode classes.

Frequently Asked Questions (FAQ) - Student & Interview Review

Add the utility class .h-100 to your .card elements. Because the parent grid columns are flex items with equal height, h-100 forces each card to stretch to 100% of the column height.
.card-group renders cards joined together with shared borders as a single seamless unit. Grid cards (.row & .col) render independent floating cards with customizable gutter spacing.
Yes! Use the .card-img-overlay class inside the card instead of .card-body.

Next Step in Your Bootstrap Learning Path:

Advance your practical frontend engineering skills with the next topic in our synchronized curriculum.

Continue to Class 23: Dropdowns & Split Menus → Previous: ← Class 21: Offcanvas Sidebars | Full Syllabus

Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Reddit

You may also like this!