Home > Web Front-end > Front-end Q&A > How to merge rows in html5

How to merge rows in html5

WBOY
Release: 2021-12-21 11:47:02
Original
5859 people have browsed it

在html中,可以利用rowspan属性实现合并行的操作,rowspan属性用于定义单元格应该横跨的行数,也就是合并的行数,语法为“

”。

How to merge rows in html5

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

html5如何合并行

在html中想要合并行,需要利用rowspan属性。

rowspan 属性定义单元格应该横跨的行数。语法如下:

其中number规定单元格应该横跨的行数。注意: rowspan="0" 告知浏览器使单元格横跨到表格组件中的最后一个行(thead、tbody 或 tfoot)。

示例如下:

<html>
<head> 
<meta charset="utf-8"> 
<title>123</title> 
</head>
<body>
<table border="1">
  <tr>
    <th>Month</th>
    <th>Savings</th>
    <th>Savings for holiday!</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
    <td rowspan="2">$50</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>
</body>
</html>
Copy after login

输出结果:

How to merge rows in html5

推荐教程:《html视频教程

The above is the detailed content of How to merge rows in html5. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template