NOTICE: This website is no longer updated or supported - as such many of the techniques used to build it may seem antiquated in the modern day. It is preserved for historical reasons only.

HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<caption> (Figure or Table Caption)


This element is used within the table element to define a caption.

Standard Syntax


<caption
align="bottom | left | right | top" (transitional)
class="class name(s)"
dir="ltr | rtl"
id="unique alphanumeric identifier"
lang="language code"
style="style information"
title="advisory text"
</caption>

Attributes Defined by Internet Explorer


accesskey="key" (5.5)
contenteditable="false | true | inherit" (5.5)
hidefocus="true | false" (5.5)
language="javascript | jscript | vbs | vbscript" (4)
tabindex="number" (5.5)
unselectable="on | off" (5.5)
valign="bottom | top" (4)

Standard Events


onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

Events Defined by Internet Explorer


onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresizeend, onresizestart, onselectstart, ontimeerror

Element Specific Attributes


align
This attribute specifies the alignment of the caption. HTML 4 defines bottom, left, right, and top as legal values. Internet Explorer and WebTV also support center. Because this does not provide the possibility to combine vertical and horizontal alignments, Microsoft has introduced the valign attribute for the <caption> element.

valign
This Internet Explorer-specific attribute specifies whether the table caption appears at the top or bottom.

Example


<table>
  <caption align="top">
Our High-Priced Menu</caption>
<tr>
  <td>
Escargot</td>
  <td>
Filet Mignon</td>
  <td>
Big Mac</td>
</tr>
</table>

Compatibility


HTML 2, 3.2, 4, 4.01, and XHTML 1.0, 1.1, Basic
Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4- 4.7, 6, 7
Opera 4-7

Notes


There should be only one caption per table.
HTML 3.2 defines only the align attribute with values of bottom and top. No other attributes are defined prior to HTML 4. WebTV adds a center value to the align attribute.

(X)HTML Elements
CSS Properties
Previous: button Next: center
< Home | About | Chapters | Examples | Errata | Reference | Site Map >