HTML <colgroup> span attribute
Definition and Usage
span
Attribute defines the number of columns that the <colgroup> element should span.
Tip:If you need to define different attributes for a specific column within <colgroup>, use <col> Tag.
Example
Use the span attribute of <colgroup> to set the background color of the first two columns:
<table> <colgroup span="2" style="background:#B0C4DE"></colgroup> <tr> <th>ISBN</th> <th>Title</th> <th>Price</th> </tr> <tr> <td>3476896</td> <td>HTML Tutorial</td> <td>$53</td> </tr> <tr> <td>5869207</td> <td>CSS Tutorial</td> <td>$49</td> </tr> </table>
Syntax
<colgroup span="number">
Attribute Value
Value | Description |
---|---|
number | Set the number of columns to span for the column group. |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |