Table title"; the caption tag must be placed directly after the table tag, and each table only Ability to define a title."/> Table title"; the caption tag must be placed directly after the table tag, and each table only Ability to define a title.">

Home  >  Article  >  Web Front-end  >  What does caption mean in html5?

What does caption mean in html5?

WBOY
WBOYOriginal
2021-12-17 15:04:265148browse

html5里边caption的意思是“表格标题”,caption标签用于给表格元素添加标题,语法为“

表格标题”;caption标签必须直接放置到table标签之后,且每个表格只能定义一个标题。

What does caption mean in html5?

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

html5里边caption是什么意思

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

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

提示:通常这个标题会被居中于表格之上。然而,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>

输出结果:

What does caption mean in html5?

推荐教程:《html视频教程

The above is the detailed content of What does caption mean in html5?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn