Bootstrap 5 Figure
The Bootstrap 5 Figure component provides semantic HTML structure for displaying images or illustrations alongside a caption using the <figure> and <figcaption> elements styled with .figure, .figure-img, and .figure-caption classes. It handles responsive image sizing and consistent caption typography out of the box. Use it whenever an image requires descriptive context — product shots, charts, editorial photography, or any visual that benefits from a direct label.
Primary Class
.figureCommon Use Cases
- →Displaying a product photograph with a caption identifying the model name and SKU on an e-commerce detail page
- →Presenting a data chart or infographic in a blog post with a caption citing the data source
- →Showcasing portfolio work in a case study with a caption describing the project and year
- →Embedding a map screenshot in a location or venue page with a caption noting the address or neighbourhood
Variants & Classes
| Variant | Description |
|---|---|
| Figure Default | Standard figure with Bootstrap's default styling. |
| Figure Responsive | Responsive variant that adapts to different screen sizes. |
Code Example
<figure class="figure">
<img
src="/assets/img/tokyo-skyline.jpg"
class="figure-img img-fluid rounded"
alt="Tokyo skyline at dusk viewed from Shinjuku"
width="800"
height="533"
/>
<figcaption class="figure-caption text-end">
Tokyo skyline at dusk, Shinjuku District — © Kenji Mori 2023
</figcaption>
</figure>Live Examples
Basic Figure
Canvas Framework Variants
The Canvas template extends Bootstrap 5 with 1,658+ component variants. Generate any of these using Canvas Builder:
- ✓Canvas Builder generated figure with custom colours
- ✓Figure with interactive states
- ✓Responsive figure for all screen sizes
Best Practices
Always include descriptive alt text alongside the caption
The .figure-caption is visible text for sighted users, but the img alt attribute serves screen readers — they serve different accessibility roles, so both should be present and meaningful rather than identical.
Use .text-end or .text-center on .figure-caption to align with the image edge
By default captions are left-aligned; adding .text-end mirrors the convention used in print editorial layouts and visually ties the caption to the right edge of the image.
Pair .img-fluid with a max-width utility to constrain oversized figures
Adding style="max-width: 640px;" or a utility class like .w-75 on the <figure> element itself prevents full-bleed figures in wide containers without breaking responsive scaling on small screens.
Nest figures inside Bootstrap grid columns for multi-image layouts
Wrapping each <figure class="figure"> inside a .col element lets you build side-by-side comparison figures — useful for before/after product shots or multi-angle portfolio views — without writing any custom CSS.