<caption>

简介

HTML <caption> 元素 (or HTML 表格标题元素) 展示一个表格的标题, 它常常作为 <table> 的第一个子元素出现,同时显示在表格内容的最前面,但是,它同样可以被CSS样式化,所以,它同样可以出现在任何一个一个相对于表格的做任意位置。

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 不允许,开始标签和结束标签都不能省略。
Permitted parent elements A <table> element, as its first descendant.
DOM interface HTMLTableCaptionElement

特性

本元素包含了所有 全局特性

align 已废弃 HTML4.01 已废弃 HTML5
This enumerated attribute indicates how the caption must be aligned with respect to the table. It may have the following values:
  • left, displayed to the left of the table
  • top, displayed before the the table
  • right, displayed to the right of the table
  • bottom, displayed under the table
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.

Examples

Please see the <table> page for examples on <caption>

Specifications

Specification Status Comment
WHATWG HTML Living Standard
<caption>
Living Standard  
HTML5
<caption>
Recommendation  
HTML 4.01 Specification
<caption>
Recommendation  

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

文档标签和贡献者