Bootstrap 5 – Examples & Templates
Estimated reading: 5 minutes 13 views

🧱 Bootstrap 5 Cards & Components Demo – Layout, Content Blocks & UI Examples

🧲 Introduction – Build Flexible UI Blocks with Bootstrap 5 Cards

Bootstrap 5 Cards are modular content containers used for displaying text, images, buttons, and structured layouts in a clean, responsive format. Combined with components like headers, footers, buttons, list groups, and grids, they are perfect for dashboards, product displays, and user profiles.

🎯 In this guide, you’ll learn:

  • How to structure Bootstrap cards using .card, .card-body, .card-img-*, and .card-footer
  • Create cards with images, buttons, headers, and list groups
  • Use grid and flex utilities inside cards
  • Stack cards for responsive, repeatable layouts

✅ Example 1 – Basic Card with Title and Text

<div class="card" style="width: 18rem;">
  <div class="card-body">
    <h5 class="card-title">Card Title</h5>
    <p class="card-text">This is a basic card using Bootstrap 5 components.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>
ClassDescription
.cardContainer for card content
.card-bodyWraps all inner text or elements
.card-titleAdds heading-like text
.card-textStandard paragraph styling inside cards

📌 A basic layout for informational or clickable content blocks.


✅ Example 2 – Card with Image on Top

<div class="card" style="width: 18rem;">
  <img src="https://via.placeholder.com/286x160" class="card-img-top" alt="...">
  <div class="card-body">
    <h5 class="card-title">Card with Image</h5>
    <p class="card-text">Image appears on top, followed by content.</p>
  </div>
</div>
ClassDescription
.card-img-topDisplays image above card body

📌 This structure is ideal for showcasing products, blog posts, or profiles.


✅ Example 3 – Cards with Header and Footer

<div class="card text-center">
  <div class="card-header">
    Featured
  </div>
  <div class="card-body">
    <h5 class="card-title">Special Offer</h5>
    <p class="card-text">Use this card to highlight featured content.</p>
    <a href="#" class="btn btn-success">Claim Now</a>
  </div>
  <div class="card-footer text-muted">
    2 days left
  </div>
</div>
ClassDescription
.card-headerTop section for labels or tabs
.card-footerBottom section for meta or actions

📌 Great for promotions, alerts, or status-based layouts.


✅ Example 4 – Card with List Group Items

<div class="card" style="width: 18rem;">
  <div class="card-header">
    Featured Items
  </div>
  <ul class="list-group list-group-flush">
    <li class="list-group-item">Item One</li>
    <li class="list-group-item">Item Two</li>
    <li class="list-group-item">Item Three</li>
  </ul>
</div>
ClassDescription
.list-group-flushRemoves border-radius around list
.list-group-itemAdds styled list items inside the card

📌 Ideal for feature lists, menus, notifications, or profiles.


✅ Example 5 – Responsive Card Grid

<div class="row row-cols-1 row-cols-md-3 g-4">
  <div class="col">
    <div class="card h-100">
      <img src="https://via.placeholder.com/286x160" class="card-img-top" alt="...">
      <div class="card-body">
        <h5 class="card-title">Card 1</h5>
        <p class="card-text">This card has supporting text below.</p>
      </div>
    </div>
  </div>
  <!-- Repeat for other cards -->
</div>
ClassDescription
.row-cols-*Sets how many cards per row by breakpoint
.g-4Adds gutter spacing between cards
.h-100Ensures all cards have equal height

📌 A grid of equal-height cards perfect for galleries or product listings.


📘 Bootstrap 5 Card Utility Reference

FeatureClassDescription
Container.cardBase wrapper for all card content
Image.card-img-top / .card-img-bottomAdds image above or below card body
Body.card-bodyInner content container
Header/Footer.card-header, .card-footerOptional header/footer sections
Layout.row-cols-*, .h-100, .g-*Responsive grid and equal height controls
List Items.list-group, .list-group-itemDisplay structured list inside card

🛠️ Best Practices for Cards & Components

TipWhy It’s Effective
Use .h-100 for uniform card heightsImproves grid alignment across multiple cards
Combine .row-cols-* for layoutsCreates responsive multi-column card groups
Keep cards modularReusable for blog posts, products, profiles, etc.
Apply shadows, borders via utilitiesEnhances visual separation without custom CSS

📌 Summary – Recap & Next Steps

Bootstrap 5 cards are a modular UI pattern ideal for organizing content into readable, aesthetic blocks. Combined with components like headers, footers, images, and list groups, they can serve nearly any layout use case.

🔍 Key Takeaways:

  • Use .card and .card-body to structure content
  • Add images with .card-img-top or .card-img-bottom
  • Include headers, footers, and list groups for rich card components
  • Arrange cards in rows using .row-cols-* and .g-* for spacing

⚙️ Perfect for blog previews, product grids, testimonials, feature boxes, and dashboards.


❓ FAQs – Bootstrap 5 Cards & UI Components

Can I stack buttons or images inside cards?
✅ Yes. Combine .btn, .card-img-top, and other elements inside .card-body.


How do I equalize card height in a grid?
✅ Use .h-100 on .card and ensure parent uses .row with .g-*.


Can cards be used inside modals or tabs?
✅ Absolutely. Cards are flexible and can live inside any component or layout section.


How do I add hover effects or shadows to cards?
✅ Use .shadow, .hover-shadow, or custom CSS. Bootstrap 5 supports utility-based shadow classes.


Share Now :

Leave a Reply

Your email address will not be published. Required fields are marked *

Share

Bootstrap 5 – Cards & Components Demo

Or Copy Link

CONTENTS
Scroll to Top