HTML <figure> tagS2C Home   « HTML <figure> tag

Definition

The <figure> tag specifies self-contained content such as images, diagrams, photos etc.

The <figure> HTML tag is used in conjunction with the <figcaption> tag which adds a caption to the content.

The <figure> tag was introduced in HTML5.

Example


  <figure>
    <img src="http://htmldoctor.info/images/chickenpie.webp" alt="Chicken Pie">
    <figcaption>Homemade chicken pie</figcaption>
  </figure>
Chicken Pie
Homemade chicken pie

Attributes

The following attributes can be used with the <figure> tag.


<figure> Specific Attributes
Attribute Value Description Example
There are no required or optional attributes specific to the <figure> tag.
<figure> Global Attributes
Attribute Description Example
Common
classSpecifies a classname for the element allowing you to apply the style of the predefined class to the content.

<figure class="name">Figure content</figure>
idSpecifies a unique id for the element allowing you to apply the style of the predefined id to the content.

<figure id="name">Figure content</figure>
styleSpecifies an inline style for the element allowing you to apply the style to the contentt.

<figure style="color:red;">Figure content</figure>
titleSpecifies an inline style for the element allowing you to apply the style to the content.

<figure title="Content info">Figure content</figure>
Keyboard
accesskeySpecifies a keyboard shortcut to associate with the element.

<figure accesskey="a">Figure content</figure>
tabindexSpecifies a tab order for the element.

<figure tabindex="1">Figure content</figure>
Language
dirSpecifies the directional flow of the content.

<!-- The text will flow from left to right -->
<figure dir="ltr">Figure content</figure>
<!-- The text will flow from right to left -->
<figure dir="rtl">Figure content</figure>
langSpecifies a language code for the content of the element.

<figure lang="en">Figure content</figure>
spellcheckSpecifies an inline style for the element allowing you to apply the style to the contentt.

<!-- Valid values true and false. -->
<!-- Default inherited / browser specific. -->
<figure spellcheck="true">Figure content</figure> 
translateSpecifies an inline style for the element allowing you to apply the style to the content.

<!-- Valid values yes and no. -->
<!-- Default yes. -->
<figure translate="no">Figure content</figure> 
Miscellaneous
contenteditableSpecifies whether the content of the element is editable.

<!-- Valid values true and false. -->
<!-- Default inherited. -->
<figure contenteditable="true">Figure content</figure> 
draggableSpecifies whether the element is draggable.

<!-- Valid values true and false. -->
<!-- Default browser specific. -->
<figure draggable="true">Figure content</figure>
hiddenSpecifies whether the element is not yet, or no longer, relevant.

<!-- Valid values an empty string or hidden -->
<figure hidden>Figure content</figure> 
<figure hidden="hidden">Figure content</figure> 
<figure> Event Attributes
Attribute Description Example
Document Element
oncopyThe script to be run when the user copies the content of an element.

 <!-- Executes go() function -->
<figure oncopy="go()">Figure content</figure> 
oncutThe script to be run when the user cuts the content of an element.

 <!-- Executes go() function -->
<figure oncut="go()">Figure content</figure>
onpasteThe script to be run when the user pastes some content into an element.

 <!-- Executes go() function -->
<figure onpaste="go()">Figure content</figure>
Drag and Drop
ondragThe script to be run when an element is dragged.

 <!-- Executes go() function -->
<figure ondrag="go()">Figure content</figure>
ondragendThe script to be run when an element has stopped being dragged.

 <!-- Executes go() function -->
<figure ondragend="go()">Figure content</figure>
ondragenterThe script to be run when an element has been dragged to a valid drop target.

 <!-- Executes go() function -->
<figure ondragenter="go()">Figure content</figure>
ondragleaveThe script to be run when an element leaves a valid drop target.

 <!-- Executes go() function -->
<figure ondragleave="go()">Figure content</figure>
ondragoverThe script to be run when an element is being dragged over a valid drop target.

 <!-- Executes go() function -->
<figure ondragover="go()">Figure content</figure>
ondragstartThe script to be run at the start of a drag operation.

 <!-- Executes go() function -->
<figure ondragstart="go()">Figure content</figure>
ondropThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<figure ondrop="go()">Figure content</figure>
Form
onblurThe script to be run when the element loses focus.

 <!-- Executes go() function -->
<figure onblur="go()">Figure content</figure>
onchangeThe script to be run when object changed and attempt to leave field.

 <!-- Executes go() function -->
<figure onchange="go()">Figure content</figure>
oncontextmenuThe script to be run when a context menu is triggered.

 <!-- Executes go() function -->
<figure oncontextmenu="go()">Figure content</figure>
onfocusThe script to be run when the element gets focus.

 <!-- Executes go() function -->
<figure onfocus="go()">Figure content</figure>
oninputThe script to be run when an element gets user input.

 <!-- Executes go() function -->
<figure oninput="go()">Figure content</figure>
oninvalidThe script to be run when an element is invalid.

 <!-- Executes go() function -->
<figure oninvalid="go()">Figure content</figure>
onresetThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<figure onreset="go()">Figure content</figure>
onselectThe script to be run when some or all of the contents of an object are selected.

 <!-- Executes go() function -->
<figure onselect="go()">Figure content</figure>
onsubmitThe script to be run when a form is submitted.

 <!-- Executes go() function -->
<figure onsubmit="go()">Figure content</figure>
Keyboard
onkeydownThe script to be run when an element is in focus and keyboard key is pressed down.

 <!-- Executes go() function -->
<figure onkeydown="go()">Figure content</figure>
onkeypressThe script to be run when an element is in focus and keyboard key is pressed down and released.

 <!-- Executes go() function -->
<figure onkeypress="go()">Figure content</figure>
onkeyupThe script to be run when an element is in focus and keyboard key is released.

 <!-- Executes go() function -->
<figure onkeyup="go()">Figure content</figure>
Media
onabortThe script code to be run on abort.

 <!-- Executes go() function -->
<figure onabort="go()">Figure content</figure>
oncanplayThe script to be run when a file has buffered enough so it is ready to start playing.

 <!-- Executes go() function -->
<figure oncanplay="go()">Figure content</figure>
oncanplaythroughThe script to be run when a file can be played all the way to the end without further need of buffering.

 <!-- Executes go() function -->
<figure oncanplaythrough="go()">Figure content</figure>
oncuechangeThe script to be run when the cue changes when using the track element.

 <!-- Executes go() function -->
<figure oncuechange="go()">Figure content</figure>
ondurationchangeThe script to be run when the length of the media is changed.

 <!-- Executes go() function -->
<figure ondurationchange="go()">Figure content</figure>
onemptiedThe script to be run when a media resource element suddenly becomes empty, usually due to an error.

 <!-- Executes go() function -->
<figure onemptied="go()">Figure content</figure>
onendedThe script to be run when the media has reach the end.

 <!-- Executes go() function -->
<figure onended="go()">Figure content</figure>
onloadeddataThe script to be run when media data is loaded and playback can start.

 <!-- Executes go() function -->
<figure onloadeddata="go()">Figure content</figure>
onloadedmetadataThe script to be run when metadata has been loaded.

 <!-- Executes go() function -->
<figure onloadedmetadata="go()">Figure content</figure>
onloadstartThe script to be run whenthe media resource has started loading.

 <!-- Executes go() function -->
<figure onloadstart="go()">Figure content</figure>
onpauseThe script to be run when the media resource has been paused.

 <!-- Executes go() function -->
<figure onpause="go()">Figure content</figure>
onplayThe script to be run when the media resource starts playback.

 <!-- Executes go() function -->
<figure onplay="go()">Figure content</figure>
onplayingThe script to be run when when playback has already begun.

 <!-- Executes go() function -->
<figure onplaying="go()">Figure content</figure>
onprogressThe script to be run when the browser is fetching the media data.

 <!-- Executes go() function -->
<figure onprogress="go()">Figure content</figure>
onratechangeThe script to be run when the playback rate changes.

 <!-- Executes go() function -->
<figure onratechange="go()">Figure content</figure>
onseekedThe script to be run when the seeking attribute is set to false indicating that seeking has finished.

 <!-- Executes go() function -->
<figure onseeked="go()">Figure content</figure>
onseekingThe script to be run when the seeking attribute is set to true indicating that seeking is currently active.

 <!-- Executes go() function -->
<figure onseeking="go()">Figure content</figure>
onstalledThe script to be run when the browser is unable to continue fetching media data.

 <!-- Executes go() function -->
<figure onstalled="go()">Figure content</figure>
onsuspendThe script to be run when media data has stopped before being completely loaded.

 <!-- Executes go() function -->
<figure onsuspend="go()">Figure content</figure>
ontimeupdateThe script to be run when the media resources current playback position has changed.

 <!-- Executes go() function -->
<figure ontimeupdate="go()">Figure content</figure>
onvolumechangeThe script to be run when the volume has changed or been muted.

 <!-- Executes go() function -->
<figure onvolumechange="go()">Figure content</figure>
onwaitingThe script to be run when the media resource has paused but is expected to resume.

 <!-- Executes go() function -->
<figure onwaiting="go()">Figure content</figure>
Mouse
onclickThe script to be run when when a mouse is clicked on an element.

 <!-- Executes go() function -->
<figure onclick="go()">Figure content</figure>
ondblclickThe script to be run when a mouse is double clicked on an element.

 <!-- Executes go() function -->
<figure ondblclick="go()">Figure content</figure>
onmousedownThe script to be run when he mouse button is pressed down while the cursor is over an element.

 <!-- Executes go() function -->
<figure onmousedown="go()">Figure content</figure>
onmousemoveThe script to be run when the mouse button is moved.

 <!-- Executes go() function -->
<figure onmousemove="go()">Figure content</figure>
onmouseoutThe script to be run when the mouse cursor moves off an element.

 <!-- Executes go() function -->
<figure onmouseout="go()">Figure content</figure>
onmouseoverThe script to be run when the mouse cursor moves over an element.

 <!-- Executes go() function -->
<figure onmouseover="go()">Figure content</figure>
onmouseupThe script to be run when the mouse button is released while the cursor is over the element.

 <!-- Executes go() function -->
<figure onmouseup="go()">Figure content</figure>
onwheelThe script to be run when the mouse wheel rolls up or down over an element.

 <!-- Executes go() function -->
<figure onwheel="go()">Figure content</figure>
Scroll
onscrollThe script code to be run when the scrollbar of an element is being scrolled.

 <!-- Executes go() function -->
<figure onscroll="go()">Figure content</figure> 
Window - NONE

Relevant HTML Tutorials

HTML Intermediate - Image Flexibility