Anytime you need to display a piece of content—like an image with an optional caption, consider using a Figure
component.
Use the included Figure
, Img
and Figcaption
component 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 fluid
attribute to your Img
to make it responsive.
vue
<template>
<BFigure>
<BFigureImage
src="https://dummyimage.com/400x300/787878/ffffff&text=400x300"
fluid
rounded
alt="400x300"
/>
<BFigureCaption>A caption for the above image.</BFigureCaption>
</BFigure>
</template>
Aligning the figure's caption is easy with our text utilities .
vue
<template>
<BFigure>
<BFigureImage
src="https://dummyimage.com/400x300/787878/ffffff&text=400x300"
fluid
rounded
alt="400x300"
/>
<BFigureCaption text-alignment="end">
A caption for the above image.
</BFigureCaption>
</BFigure>
</template>