The <figure> and <figcaption> Elements

In books and newspapers, it is common to have captions with images. The purpose of a caption is to add a visual explanation to an image. With HTML5, images and captions can be grouped together in <figure> elements:

<figure style="border:4px solid teal;"">

   <img src="../html_beg/images/ghost.png"
      alt="My Pet Ghost" width="256" height="256"
      class="center" />

   <figcaption style="text-align:center;">
      Figure #1: -- My pet ghost
   </figcaption>

</figure>
My Pet Ghost
Figure #1: -- My pet ghost

The <img> element defines the image, the <figcaption> element defines the caption.

Back button Table of Contents Next button