HTML <caption> Tag

Description

The <caption> HTML element is intended to create a heading to the table and can only be placed inside the <tablegt; container, and immediately after the opening tag. The title is the text displayed by default in front of the table and describing its contents.

Properties

Permitted Parents
A <table> element, as its first descendant
Content
Inline and text
Start/End Tags
Start tag: required, End tag: required

Example

<table border="1">
<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>

Attributes

Attribute Definition
align

Specifies the alignment of the caption.
Possible Values:

  • left
  • right
  • top
  • bottom

Global Attributes

The <caption> tag also supports the Global Attributes in HTML5

Event Attributes

The <caption> tag also supports the Event Attributes in HTML5

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
YesYesYes1YesYes
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
YesYes4YesYesYes

Last updated by CSSPortal on: 6th December 2019