The HTML5 figure
element allows an assistive technology to skip secondary content, thereby
enabling readers to continue reading the primary narrative uninterrupted. Because figures are
interspersed within the body, like asides, without being able to clearly identify them the reader would
be constantly interrupted at the points where they occur.
The figure
element can be used to encapsulate images, tables, code snippets and other content
with a related caption, description and/or associated content elements.
The element should only be used for secondary content that can be read separately from the main narrative.
Do not wrap every img
tag in a figure
, for example, only the ones that are
offset from the narrative.
Being able to programmatically determine the caption for a figure is another useful feature introduced in HTML5. As captions are often placed under the content of the figure, readers in the past have often had no context for the figure until reaching the descriptive text that followed the image or table.
The figcaption
element can now be used to mark up the caption. This element must be the very
first or last in the figure
to be valid to the HTML5 definition.
Note
The details
element has been removed from HTML5, but remains under development for HTML
5.1. As use of the element cannot be guaranteed to pass future updates to epubcheck, it is not
recommended for describing content at this time.