With HTML5, a couple new elements were introduced to further assist with images. These are “figure” (<figure>
) and “figure caption” (<figcaption>
). These can be used together to easily group figures or images with associated captions.
The figure element is used as a container to group together one or more images with a caption. Within the figure element, you would place your img or related elements.
Within this figure element you will also place your caption elements.
<figure>
<img src="imgs/chihuahua.jpg" alt="Picture of a cute Chihuahua in a teacup" title="Chihuahua in a Teacup" width="640" height="426">
<br />
<figcaption>An adorably cute chihuahua in a teacup!</figcaption>
</figure>