html5 <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>
所有主流浏览器都支持 <caption> 标签。
<caption> 标签定义表格的标题。
<caption> 标签必须直接放置到 <table> 标签之后。
您只能对每个表格定义一个标题。
提示:通常这个标题会被居中于表格之上。然而,css 属性 "text-align" 和 "caption-side" 能用来设置标题的对齐方式和显示位置。
html5 不支持 align 属性。
html 4.01 已废弃 align 属性。
属性 | 值 | 描述 |
---|---|---|
align (已废弃) | left right top bottom | html5 不支持。html 4.01 已废弃。 定义标题的对齐方式。 |
使用说明: 当 <table> 元素是 <caption> 的父元素,caption是 <figure> 元素的唯一后代的时候,使用 <figcaption> 元素替代 caption 元素
<caption> 标签支持 html 的全局属性。
<caption> 标签支持 html 的事件属性。