Home >Web Front-end >Front-end Q&A >Is caption a new addition to HTML5?

Is caption a new addition to HTML5?

WBOY
WBOYOriginal
2022-04-11 17:22:482075browse

caption不是html5新增的。caption标签是html中用于定义表格标题的,并且该标签必须放置在table标签后,一个表格只能定义一个标题;在html5中已经不支持标签内的align属性,在html4.01时已废弃align属性。

Is caption a new addition to HTML5?

本文操作环境:Windows10系统、html5版、Dell G3电脑。

caption是html5新增的吗

标签定义表格的标题。

标签必须直接放置到 标签之后。

您只能对每个表格定义一个标题。

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

HTML5 不支持 align 属性。

HTML 4.01 已废弃 align 属性。

示例如下:

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>123</title> 
</head>
<body>
<table border="1">
  <caption>Monthly savings</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>

输出结果:

Is caption a new addition to HTML5?

推荐教程:《html视频教程

The above is the detailed content of Is caption a new addition to 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