HTML <caption> 标签


实例

带有标题的表格:

<table border="1"> <caption>Monthly savings</caption> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> </table>


浏览器支持

Internet Explorer Firefox Opera Google Chrome Safari

所有主流浏览器都支持 <caption> 标签。


标签定义及使用说明

<caption> 标签定义表格的标题。

<caption> 标签必须直接放置到 <table> 标签之后。

您只能对每个表格定义一个标题。

提示:通常这个标题会被居中于表格之上。然而,CSS 属性 "text-align" 和 "caption-side" 能用来设置标题的对齐方式和显示位置。


HTML 4.01 与 HTML5之间的差异

HTML5 不支持 align 属性。

HTML 4.01 已废弃 align 属性。


属性

属性 描述
align left
right
top
bottom
HTML5 不支持。HTML 4.01 已废弃。 定义标题的对齐方式。


全局属性

<caption> 标签支持 HTML 的全局属性


事件属性

<caption> 标签支持 HTML 的事件属性