HTML5 Reference

HTML <figcaption> tag

Definition

The <figcaption> tag is used to provide a caption when using the <figure> tag.

The <figcaption> tag must be the first or last child within the <figure> tag.

The <figcaption> 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 <figcaption> tag.


<figcaption> Specific Attributes
Attribute Value Description Example
There are no required or optional attributes specific to the <figcaption> tag.
<figcaption> 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.

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

<figcaption id="name">Caption text</figcaption>
styleSpecifies an inline style for the element allowing you to apply the style to the contentt.

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

<figcaption title="Content info">Caption text</figcaption>
Keyboard
accesskeySpecifies a keyboard shortcut to associate with the element.

<figcaption accesskey="a">Caption text</figcaption>
tabindexSpecifies a tab order for the element.

<figcaption tabindex="1">Caption text</figcaption>
Language
dirSpecifies the directional flow of the content.

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

<figcaption lang="en">Caption text</figcaption>
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. -->
<figcaption spellcheck="true">Caption text</figcaption> 
translateSpecifies an inline style for the element allowing you to apply the style to the content.

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

<!-- Valid values true and false. -->
<!-- Default inherited. -->
<figcaption contenteditable="true">Caption text</figcaption> 
draggableSpecifies whether the element is draggable.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 <!-- Executes go() function -->
<figcaption onkeyup="go()">Caption text</figcaption>
Media
onabortThe script code to be run on abort.

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

 <!-- Executes go() function -->
<figcaption oncanplay="go()">Caption text</figcaption>
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 -->
<figcaption oncanplaythrough="go()">Caption text</figcaption>
oncuechangeThe script to be run when the cue changes when using the track element.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 <!-- Executes go() function -->
<figcaption onscroll="go()">Caption text</figcaption> 
Window - NONE

Relevant HTML Tutorials

HTML Intermediate - Image Flexibility