HTML <col> spanAttribute
Examples
Here, the background color of the first two columns is red:
<table border="1">
<colgroup>
<col span="2" style="background-color:red" />
<col style="background-color:yellow" />
</colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td>3476896</td>
<td>My first HTML</td>
<td>$53</td>
</tr>
</table>
<colgroup>
<col span="2" style="background-color:red" />
<col style="background-color:yellow" />
</colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td>3476896</td>
<td>My first HTML</td>
<td>$53</td>
</tr>
</table>
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the span attribute.
Definition and Usage
The span attribute specifies the number of columns a col element should span.
Differences between HTML 4.01 and HTML5
NONE.
Syntax
<col span="number">
Attribute Values
| Value | Description |
|---|---|
| number | Sets the number of columns the col element should span. |
HTML <col> Tag Other Extensions