Use the span attribute to set the number of columns to span in HTML. You can try to run the following code to implement span attribute −
Example
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<colgroup>
<col span = "1" style = "background-color:grey">
</colgroup>
<tr>
<th>S.NO</th>
<th>Name</th>
</tr>
<tr>
<td>1</td>
<td>Amit</td>
</tr>
</table>
</body>
</html>