Card - Bootstrap 5

Bootstrap's cards provide a flexible and extensible content container. It includes options for headers and footers, a wide variety of content, contextual background colors, and powerful display options.

Cards have no fixed width to start, so they’ll naturally fill the full width of its parent element. Class .card-img-top places an image to the top of the card.

Card Body

The building block of a card is the .card-body. Use it whenever you need a padded section within a card.

Example 1: Bootstrap card with body class

<div class="card">
  <div class="card-body">
    This is some text within a card body.
  </div>
</div>
This is some text within a card body.

Titles, text, and links

Card titles are used by adding .card-title to a <h*> tag.

Subtitles are used by adding a .card-subtitle to a <h*> tag.

Links are added and placed next to each other by adding .card-link to an <a> tag.

All the above items are placed in a .card-body

Example 2: Bootstrap card with title, subtitle, text, link classes.

<div class="card">
  <div class="card-body">
    <h5 class="card-title">Card title</h5>
    <h6 class="card-subtitle mb-2 text-muted">Card subtitle</h6>
    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    <a href="#" class="card-link">Card link</a>
    <a href="#" class="card-link">Another link</a>
  </div>
</div>
Card title
Card subtitle

Some quick example text to build on the card title and make up the bulk of the card's content.

Card link Another link

Card Header and footer

Add an optional header and/or footer within a card. Card headers can be styled by adding .card-header to <div> or <h*> above .card-body elements.

Example 3: Card Header using div tag

<div class="card">
  <div class="card-header">Featured - Card Header</div>
  <div class="card-body">
    <h5 class="card-title">Special title treatment</h5>
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>
Featured - Card Header
Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere

Example 4: Card Header using heading tag

<div class="card">
  <h5 class="card-header">Featured</h5>
  <div class="card-body">
    <h5 class="card-title">Special title treatment</h5>
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>
Featured
Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere

Example 5: Card displaying quote with card header, body.

<div class="card">
  <div class="card-header">Quote</div>
  <div class="card-body">
    <blockquote class="blockquote mb-0">
      <p>A well-known quote, contained in a blockquote element.</p>
      <footer class="blockquote-footer">Someone famous in <cite title="Source Title">Source Title</cite></footer>
    </blockquote>
  </div>
</div>
Quote

A well-known quote, contained in a blockquote element.

Someone famous in Source Title

Example 6: Card with header, body, footer.

<div class="card text-center">
  <div class="card-header">
    Featured
  </div>
  <div class="card-body">
    <h5 class="card-title">Special title treatment</h5>
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
  <div class="card-footer text-muted">
    2 days ago
  </div>
</div>
Featured
Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere

Card Alignment

You can quickly change the text alignment of any card—in its entirety or specific parts using bootstrap text align classes

Card left alignment (default) - .text-start

Example 7: Bootstrap class with left alignment.

<div class="card w-50">
  <div class="card-body">
    <h5 class="card-title">Special title treatment</h5>
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>
Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere

Example 8: Bootstrap class with center alignment.

<div class="card text-center w-50">
  <div class="card-body">
    <h5 class="card-title">Special title treatment</h5>
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>
Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere

Example 9: Bootstrap class with center alignment.

<div class="card text-end w-50">
  <div class="card-body">
    <h5 class="card-title">Special title treatment</h5>
    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    <a href="#" class="btn btn-primary">Go somewhere</a>
  </div>
</div>
Special title treatment

With supporting text below as a natural lead-in to additional content.

Go somewhere

Card Images

Cards include a few options for working with images..card-img-top places an image to the top of the card

Example 10: Bootstrap top Image card with some content

<div class="card">
  <img src="your-image.ext" class="card-img-top" alt="Bootstrap 5 card">
    <div class="card-body">
        <h5 class="card-title">Card title</h5>
        <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
        <a href="#" class="btn btn-primary">Go somewhere</a>
    </div>
</div>
Bootstrap 5 card
Card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Go somewhere

Example 11: Bootstrap bottom Image card using .card-img-bottom with some content

<div class="card">
    <div class="card-body">
        <h5 class="card-title">Card title</h5>
        <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
        <a href="#" class="btn btn-primary">Go somewhere</a>
    </div>
    <img src="your-image.ext" class="card-img-bottom" alt="Bootstrap 5 card">
</div>
Card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Go somewhere
Bootstrap 5 card

Image overlays

Turn an image into a card background and overlay your card's text using .card-img and .card-img-overlay instead of .card-body

Example 12: Bootstrap Image overlays

<div class="card col-lg-4 p-0">
    <img src="your-image.ext" class="card-img" alt="Bootstrap 5 card">
    <div class="card-img-overlay text-light">
        <h5 class="card-title">Card title</h5>
        <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
        <a href="#" class="btn btn-primary">Go somewhere</a>
    </div>
</div>
Bootstrap 5 card
Card title

Some quick example text to build on the card title and make up the bulk of the card's content.

Go somewhere

Horizontal Image

Using a combination of grid cards can be made horizontal in a mobile-friendly and responsive way. Remove the grid gutters with .g-0 and use .col-md-* classes to make the card horizontal at the md breakpoint.

Example 13: Bootstrap Horizontal Image

<div class="card" style="max-width: 540px;">
  <div class="row g-0">
    <div class="col-md-4">
      <img src="..." class="img-fluid rounded-start" alt="...">
    </div>
    <div class="col-md-8">
      <div class="card-body">
        <h5 class="card-title">Card title</h5>
        <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
        <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
      </div>
    </div>
  </div>
</div>
Bootstrap 5 horizontal card
Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Last updated 3 mins ago

Card layout

In addition to styling the content within cards, Bootstrap includes a few options for laying out series of cards.

Example 14: Bootstrap card group

<div class="card-group">
  <div class="card">
    <img src="..." class="card-img-top" alt="...">
    <div class="card-body">
      <h5 class="card-title">Card title</h5>
      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
    </div>
  </div>
  <div class="card">
    <img src="/images/h1.jpg" class="card-img-top" alt="...">
    <div class="card-body">
      <h5 class="card-title">Card title</h5>
      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
    </div>
  </div>
  <div class="card">
    <img src="/images/h3.jpg" class="card-img-top" alt="...">
    <div class="card-body">
      <h5 class="card-title">Card title</h5>
      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
      <p class="card-text"><small class="text-muted">Last updated 3 mins ago</small></p>
    </div>
  </div>
</div>
Bootstrap 5 Card
Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Last updated 3 mins ago

Bootstrap 5 Card
Card title

This card has supporting text below as a natural lead-in to additional content.

Last updated 3 mins ago

Bootstrap 5 Card
Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.

Last updated 3 mins ago

Example 15: When using card groups with footers, their content will automatically line up.

Bootstrap 5 Card
Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Bootstrap 5 Card
Card title

This card has supporting text below as a natural lead-in to additional content.

Bootstrap 5 Card
Card title

This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.

Example 16: Bootstrap Card group using Grid cards

<div class="row row-cols-1 row-cols-md-3 g-4">
  <div class="col">
    <div class="card">
      <img src="..." class="card-img-top" alt="...">
      <div class="card-body">
        <h5 class="card-title">Card title</h5>
        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
      </div>
	  <div class="card-footer">
        <small class="text-muted">Last updated 3 mins ago</small>
      </div>
    </div>
  </div>
  <div class="col">
    <div class="card">
      <img src="..." class="card-img-top" alt="...">
      <div class="card-body">
        <h5 class="card-title">Card title</h5>
        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
      </div>
	  <div class="card-footer">
        <small class="text-muted">Last updated 3 mins ago</small>
      </div>
    </div>
  </div>
  <div class="col">
    <div class="card">
      <img src="..." class="card-img-top" alt="...">
      <div class="card-body">
        <h5 class="card-title">Card title</h5>
        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p>
      </div>
	  <div class="card-footer">
        <small class="text-muted">Last updated 3 mins ago</small>
      </div>
    </div>
  </div>
  <div class="col">
    <div class="card">
      <img src="..." class="card-img-top" alt="...">
      <div class="card-body">
        <h5 class="card-title">Card title</h5>
        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
      </div>
	  <div class="card-footer">
        <small class="text-muted">Last updated 3 mins ago</small>
      </div>
    </div>
  </div>
</div>
Bootstrap 5 Card
Card title

This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Bootstrap 5 Card
Card title

This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Bootstrap 5 Card
Card title

This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

Bootstrap 5 Card
Card title

This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.