Skip to content

Bootstrap Figures

The figure component wraps an image and its caption in a single semantic block. This lesson shows how to build accessible, styled figures with Bootstrap.

Bootstrap Figures Overview

HTML's native <figure> and <figcaption> elements already provide semantic meaning for self-contained content like images with captions. Bootstrap's figure classes—figure, figure-img, and figure-caption—apply consistent spacing and typography to that native markup without changing its meaning.

Because figure-img typically pairs with img-fluid and rounded, figures inherit the same responsive scaling and shape utilities used elsewhere for images, making them easy to combine with galleries, articles, and cards.

Concept Description Common Usage
.figure Wrapper block around image and caption Groups image and caption as one unit
.figure-img Styled image inside a figure Applies margin-bottom and combines with img-fluid
.figure-caption Styled caption text below the image Small, muted descriptive text
figcaption element Native semantic caption element Screen-reader-friendly image description
Combining with rounded/shadow Shape and depth utilities on figure-img Styled figure previews in galleries

Bootstrap Figures Example

<figure class="figure">
  <img src="chart.png" class="figure-img img-fluid rounded" alt="Quarterly revenue chart">
  <figcaption class="figure-caption text-center">
    Fig. 1 — Quarterly revenue growth, 2024–2025.
  </figcaption>
</figure>

The outer figure element groups the image and caption as one semantic unit. figure-img combines with img-fluid and rounded for a responsive, softly rounded image, while figure-caption styles the figcaption text as small, muted, and centered.

Top 10 Bootstrap Figures Examples

These are the figure component patterns you'll use when pairing images with captions.

# Example Syntax
1 Basic figure <figure class="figure"><img class="figure-img" src="a.jpg" alt="..."><figcaption class="figure-caption">Caption</figcaption></figure>
2 Responsive figure image <img class="figure-img img-fluid" src="a.jpg" alt="...">
3 Rounded figure image <img class="figure-img img-fluid rounded" src="a.jpg" alt="...">
4 Centered caption <figcaption class="figure-caption text-center">Caption</figcaption>
5 End-aligned caption <figcaption class="figure-caption text-end">Source: Reuters</figcaption>
6 Figure with shadow <img class="figure-img img-fluid shadow-sm" src="a.jpg" alt="...">
7 Figure inside a card <div class="card p-3"><figure class="figure mb-0">...</figure></div>
8 Grid of figures <div class="row g-4"><div class="col-md-4"><figure class="figure">...</figure></div></div>
9 Figure with border <img class="figure-img img-fluid border" src="a.jpg" alt="...">
10 Small caption text size <figcaption class="figure-caption fs-6">Caption</figcaption>

Best Practices

  • Use the native figure and figcaption elements instead of generic divs for semantic correctness.
  • Combine figure-img with img-fluid so figure images remain responsive.
  • Keep captions short and descriptive; they should add context, not repeat the alt text verbatim.
  • Use text-center or text-end on figure-caption to match the surrounding page's alignment style.
  • Group multiple figures in a grid using the standard row/column system for galleries.
  • Still provide meaningful alt text on the image even though a caption is present.
  • Use figure for content that truly stands alone from the main flow, like charts or diagrams.

Common Mistakes

  • Using a generic div instead of the semantic figure/figcaption elements.
  • Duplicating the alt text and caption verbatim instead of giving each a distinct purpose.
  • Forgetting img-fluid on figure-img, letting large images overflow their container.
  • Not aligning captions consistently with the rest of the page's typography style.
  • Wrapping unrelated content in a figure element when it isn't self-contained illustrative content.
  • Skipping figcaption entirely and placing caption text outside the figure element.

Key Takeaways

  • The figure component pairs semantic figure/figcaption markup with Bootstrap styling.
  • figure-img typically combines with img-fluid and shape utilities like rounded.
  • figure-caption provides consistent small, muted caption typography.
  • Figures work well in grids for galleries, portfolios, and documentation.
  • Meaningful alt text and captions serve different but complementary purposes.

Pro Tip

When building a documentation site, standardize figure captions to always start with a label like 'Fig. 1 —' so readers can reference specific images from the surrounding text.