简介
HTML <caption>
元素 (or HTML 表格标题元素) 展示一个表格的标题, 它常常作为 <table>
的第一个子元素出现,同时显示在表格内容的最前面,但是,它同样可以被CSS样式化,所以,它同样可以出现在任何一个一个相对于表格的做任意位置。
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- 这个可枚举属性表明了caption相对于table应该如何排列。它可能有以下几个值:
left
, 展示在表格左边top
, 显示在表格前面right
, 显示在表格右边bottom
, 显示在表格下面
使用说明
当 <table>
元素是<caption>
的父元素,caption是<figure>
元素的唯一后代的时候,使用<figcaption>
元素替代caption元素
实例
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard <caption> |
Living Standard | |
HTML5 <caption> |
Recommendation | |
HTML 4.01 Specification <caption> |
Recommendation |
Browser compatibility
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
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) |