HTML <caption> tagS2C Home   « HTML <caption> tag

Definition

The <caption> tag is used for defining a table caption.

Example


<caption>Table caption text</caption>

Required Attributes

NONE

Optional Attributes

align - deprecated - use CSS instead.

Common Attributes

class - specifies a classname for the element allowing you to apply the style of the predefined class to the content.


<caption class="classname">Table caption text</caption>

id - specifies a unique id for the element allowing you to apply the style of the predefined id to the content.


<caption id="idname">Table caption text</caption>

style - specifies an inline style for the element allowing you to apply the style to the content.


<caption style="color:red;text-align:left">Table caption text</caption>

title - specifies extra information about the content.


<caption title="information about the content">Table caption text</caption>

Language Attributes

dir - specifies the directional flow of the content.


<!-- The text will flow from left to right -->
<caption dir="ltr">Table caption text</caption>

<!-- The text will flow from right to left -->
<caption dir="rtl">Table caption text</caption>

lang - specifies a language code for the content of the element.


<caption lang="en">Table caption text</caption>

xml:lang - specifies a language code for the content of the element in XHTML documents.


<caption xml:lang="fr">Table caption text</caption>

Document Event Attributes

NONE

Form Event Attributes

NONE

Image Event Attributes

NONE

Keyboard Event Attributes

onkeydown - The JavaScript code to be run when an element is in focus and keyboard key is pressed.


<!-- Executes the go() function -->
<caption onkeydown="go()">Table caption text</caption>

onkeypress - The JavaScript code to be run when an element is in focus and keyboard key is pressed down and released.


<!-- Executes the go() function -->
<caption onkeypress="go()">Table caption text</caption>

onkeyup - The JavaScript code to be run when an element is in focus and keyboard key is released.


<!-- Executes the go() function -->
<caption onkeyup="go()">Table caption text</caption>

Mouse Event Attributes

onclick - The JavaScript code to be run when a mouse is clicked on the element.


<!-- Executes the go() function -->
<caption onclick="go()">Table caption text</caption>

ondblclick - The JavaScript code to be run when a mouse is double clicked on the element.


<!-- Executes the go() function -->
<caption ondblclick="go()">Table caption text</caption>

onmousedown - The JavaScript code to be run when the mouse button is pressed down while the cursor is over the element.


<!-- Executes the go() function -->
<caption onmousedown="go()">Table caption text</caption>

onmousemove - The JavaScript code to be run when the mouse button is moved.


<!-- Executes the go() function -->
<caption onmousemove="go()">Table caption text</caption>

onmouseout - The JavaScript code to be run when the mouse cursor moves off an element.


<!-- Executes the go() function -->
<caption onmouseout="go()">Table caption text</caption>

onmouseover - The JavaScript code to be run when the mouse cursor moves over an element.


<!-- Executes the go() function -->
<caption onmouseover="go()">Table caption text</caption>

onmouseup - The JavaScript code to be run when the mouse button is released while the cursor is over the element.


<!-- Executes the go() function -->
<caption onmouseup="go()">Table caption text</caption>

go to home page Homepage go to top of page Top