温馨提示  2024年 6月我们已经停止开发者板块文章内容更新,谢谢来访。存档数据
知识 2023-08-27 40 次阅读

html5里边caption有什么意义

   

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

本教程操作环境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>

输出结果

推荐教程《html视频教程》