<figure> semantic HTML element is used to encapsulate media such as an image, diagram, or code snippet.
<figure> is a tag that wraps around a block of HTML giving it semantic meaning. It has no special attributes, and by default will act similarly to a
<figure><!-- An image, diagram, or code snippet goes inside the tag --></figure>
<figcaption> element is used to describe the media encapsulated within the
<figure> element. Developers will normally use
<figcaption> within the
<figure> element to group the media and description. This way, if a developer decides to change the position of the media, the description will follow along with it.
<figure><img src="qwerty.jpg" /><figcaption>The image shows the layout of a qwerty keyboard.</figcaption></figure>
Suppose the current page wants to include an image and a image caption:
- Anonymous contributors
Learn HTML on Codecademy
- Anonymous contributorsAnonymous contributors