如何在HTML中包括表格列组?
使用<colgroup>标记包括表列组。HTML<colgroup>标记用于为表中的一组列指定属性。如果需要将不同的属性应用于colgroup中的列,则可以使用colgroup标签中的HTMLcol标签。
示例
您可以尝试运行以下代码以在HTML中实现<colgroup>标记-
<!DOCTYPE html>
<html>
<head>
<title>HTML col Tag</title>
</head>
<body>
<p>此示例显示具有三个不同宽度的列的 colgroup:</p>
<table border = "1">
<colgroup span = "4">
<col width = "40"></col>
<col width = "70"></col>
<col width = "100"></col>
<col width = "130"></col>
<col width = "160"></col>
</colgroup>
<tr>
<td>One</td>
<td>Two</td>
<td>Three</td>
<td>Four</td>
<td>Five</td>
</tr>
</table>
</body>
</html>