<caption>
简介
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 (en-US) |
特性
本元素包含了所有 全局特性。
使用说明
当 <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
BCD tables only load in the browser
See also
- 其他与 table 相关的 HTML 元素:
<col>
,<colgroup>
,<table>
,<tbody>
(en-US),<td>
,<tfoot>
,<th>
,<thead>
,<tr>
; - 可能对
<caption>
元素有用的 CSS 属性: