ExampleA table with a caption: | Browser Support |
1. Definition and Usage
The <caption> tag defines a table caption.
The <caption> tag must be inserted immediately after the <table> tag.
You can specify only one caption per table.
Tip: By default, the table caption will be center-aligned above a table. However, the CSS properties "text-align" and "caption-side" can be used to align and place the caption.
2. Differences Between HTML 4.01 and HTML5
The align attribute is removed from HTML5.
The align attribute is deprecated in HTML 4.01.
3. Optional Attributes
DTD indicates in which HTML 4.01/XHTML 1.0 DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
Attribute | Value | Description | DTD |
---|---|---|---|
align | left right top bottom | Deprecated. Use styles instead. Defines the alignment of a caption | TF |
4. Standard Attributes
The <caption> tag supports the Standard Attributes in HTML.
5. Event Attributes
The <caption> tag also supports the Standard Event Attributes in HTML.