当前位置:首页 > HTML5教程 > HTML5技巧

HTML <caption> 标签

html <caption> 标签

  • <canvas>

实例

<table border="1">
  <caption>monthly savings</caption>
  <tr>
    <th>month</th>
    <th>savings</th>
  </tr>
  <tr>
    <td>january</td>
    <td>$100</td>
  </tr>
</table>

亲自试一试

浏览器支持

元素 chrome ie firefox safari opera
<caption> yes yes yes yes yes

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

定义和用法

caption 元素定义表格标题。

caption 标签必须紧随 table 标签之后。您只能对每个表格定义一个标题。通常这个标题会被居中于表格之上。

html 与 xhtml 之间的差异

在 html 4.01 中,caption 元素的 align 属性是不被赞成使用的。

在 xhtml 1.0 strict dtd 中,caption 元素的 align 属性是不被支持的。

可选的属性

属性 值 描述
align
  • left
  • right
  • top
  • bottom

不赞成使用。请使用样式取而代之。

规定标题的对齐方式。

全局属性

<caption> 标签支持 html 中的全局属性。

事件属性

<caption> 标签支持 html 中的事件属性。

tiy 实例

带有标题的表格 本例演示一个带标题(caption)的表格
  • <canvas>

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐