]>
Commit | Line | Data |
---|---|---|
91e44d91 S |
1 | --- |
2 | layout: docs | |
3 | title: Figures | |
4 | description: Documentation and examples for displaying related images and text with the figure component in Bootstrap. | |
5 | group: content | |
6 | --- | |
7 | ||
8 | Anytime you need to display a piece of content—like an image with an optional caption, consider using a `<figure>`. | |
9 | ||
10 | Use the included `.figure` , `.figure-img` and `.figure-caption` classes to provide some baseline styles for the HTML5 `<figure>` and `<figcaption>` elements. Images in figures have no explicit size, so be sure to add the `.img-fluid` class to your `<img>` to make it responsive. | |
11 | ||
12 | {% example html %} | |
13 | <figure class="figure"> | |
14 | <img data-src="holder.js/400x300" class="figure-img img-fluid rounded" alt="A generic square placeholder image with rounded corners in a figure."> | |
15 | <figcaption class="figure-caption">A caption for the above image.</figcaption> | |
16 | </figure> | |
17 | {% endexample %} | |
18 | ||
19 | Aligning the figure's caption is easy with our [text utilities]({{ site.baseurl }}/utilities/typography/#text-alignment). | |
20 | ||
21 | {% example html %} | |
22 | <figure class="figure"> | |
23 | <img data-src="holder.js/400x300" class="figure-img img-fluid rounded" alt="A generic square placeholder image with rounded corners in a figure."> | |
24 | <figcaption class="figure-caption text-right">A caption for the above image.</figcaption> | |
25 | </figure> | |
26 | {% endexample %} |