Html5教程 专题
专题目录
您的位置:html > Html5教程专题 > HTML5 <caption> 标签
HTML5 <caption> 标签
作者:--    发布时间:2019-11-20

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>
尝试一下 »

浏览器支持

internet explorerfirefoxoperagoogle chromesafari

所有主流浏览器都支持 <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 已废弃。 定义标题的对齐方式。

使用说明: 当 <table> 元素是 <caption> 的父元素,caption是 <figure> 元素的唯一后代的时候,使用 <figcaption> 元素替代 caption 元素


全局属性

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


事件属性

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


网站声明:
本站部分内容来自网络,如您发现本站内容
侵害到您的利益,请联系本站管理员处理。
联系站长
373515719@qq.com
关于本站:
编程参考手册