HTML - <caption>
The HTML <caption>
Element (or HTML Table Caption Element) represents the title of a table. Though it is always the first descendant of a <table>
, its styling, using CSS, may place it elsewhere, relative to the table.
Example
Description
The HTML <caption>
Element (or HTML Table Caption Element) represents the title of a table. Though it is always the first descendant of a <table>
, its styling, using CSS, may place it elsewhere, relative to the table.
Usage note: When the
<table>
element that is the parent of this <caption>
is the only descendant of a <figure>
element, use the <figcaption>
element instead.Content categories | None. |
---|---|
Permitted content | Flow content. |
Tag omission | None, both the starting and ending tag are mandatory. |
Permitted parent elements | A <table> element, as its first descendant. |
DOM interface | HTMLTableCaptionElement |
Attributes
Includes the Global Attributes.
Name | Version | Description |
---|---|---|
align |
This enumerated attribute indicates how the caption must be aligned with respect to the table. It may have the following values:
Usage note: Do not use this attribute, as it has been deprecated: the
<caption> element should be styled using CSS. To give a similar effect to the align attribute, use the the CSS properties caption-side and text-align . |
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | 1.0 (1.7 or earlier) | (Yes) | (Yes) | (Yes) |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | (Yes) | 1.0 (1.0) | (Yes) | (Yes) | (Yes) |
See Also
Specifications
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of '<caption>' in that specification. |
Living Standard | |
HTML5 The definition of '<caption>' in that specification. |
Recommendation | |
HTML 4.01 Specification The definition of '<caption>' in that specification. |
Recommendation |
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/html/element/caption