caption是html5新增的吗-LMLPHP

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

caption是html5新增的吗

<caption> 标签定义表格的标题。

<caption> 标签必须直接放置到 <table> 标签之后。

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

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

输出结果:

caption是html5新增的吗-LMLPHP

推荐教程:《html视频教程

以上就是caption是html5新增的吗的详细内容,更多请关注Work网其它相关文章!

09-18 20:41