如何在 HTML 中設定表格單元格應跨越的行數?
使用 rowspan 屬性設定表格單元格應跨越的行數。若要在 HTML 中合併單元格,請使用 colspan 和 rowspan 屬性。rowspan 屬性用於指定單元格應跨越的行數,而 colspan 屬性用於指定單元格應跨越的列數。
示例
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
width: 100px;
height: 50px;
}
</style>
</head>
<body>
<h1>Heading</h1>
<table>
<tr>
<th colspan = "2"></th>
<th></th>
</tr>
<tr>
<td></td>
<td></td>
<td rowspan = "2"></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
安卓
Python
C 語言
C++
C#
MongoDB
MySQL
Javascript
PHP