站长资讯网
最全最丰富的资讯网站

html5里边caption是什么意思

html5里边caption的意思是“表格标题”,caption标签用于给表格元素添加标题,语法为“<caption>表格标题</caption>”;caption标签必须直接放置到table标签之后,且每个表格只能定义一个标题。

html5里边caption是什么意思

本教程操作环境:windows10系统、HTML5版、Dell G3电脑。

html5里边caption是什么意思

<caption> 标签定义表格的标题。<caption> 标签必须直接放置到 <table> 标签之后。

您只能对每个表格定义一个标题。通常标题会居中显示在表格上方。

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

语法如下:

<table><caption>表格标题</caption></table>

示例如下:

<html> <head>  <meta charset="utf-8">  <title>菜鸟教程(runoob.com)</title>  </head> <body> <table border="1">   <caption>表格标题</caption>   <tr>     <th>Month</th>     <th>Savings</th>   </tr>   <tr>     <td>January</td>     <td>$100</td>   </tr>   <tr>     <td>February</td>     <td>$50</td>   </tr> </table> </body> </html>

输出结果:

html5里边caption是什么意思

推荐教程:《html视频教程》

赞(0)
分享到: 更多 (0)