← Back to Bootstrap Course | Chapter 7: Components — Cards & Alerts | Lesson 2 of 7

Card header/footer

Headers and footers add labelled top and bottom strips to a card.

In this page:

  1. Card header/footer
Syntax
markup
<div class="card">
  <div class="card-header">Header</div>
  <div class="card-body">Body</div>
  <div class="card-footer">Footer</div>
</div>

Card header/footer

Place .card-header before the body and .card-footer after it. Headers can hold nav tabs, and footers often hold timestamps or actions. Use bg and text utilities on them for coloured variants, and .text-bg-* for whole cards.

Note: card-header can also contain nav-tabs with card-header-tabs.

Example: Card header/footer

markup
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="p-3">
<div class="container">
  <div class="card text-center">
    <div class="card-header">Featured</div>
    <div class="card-body"><h5 class="card-title">Special title</h5><p class="card-text">Supporting text.</p></div>
    <div class="card-footer text-body-secondary">2 days ago</div>
  </div>
</div>
</body>
</html>
Live Example
Related Topics
Common Mistakes
  1. Putting the header inside the body
  2. Using headings inside without hierarchy
  3. Styling with inline CSS
Chapter Summary
  • card-header sits on top
  • card-footer sits below
  • Colour with utilities
  • Headers can hold nav tabs
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.