HTML <col> span Attribute

Definition and Usage

span Attribute defines the number of columns the <col> element should span.

Example

Here, the background color of the first two columns should be red:

<table>
  <colgroup>
    <col span="2" style="background-color:#B0C4DE">
    <col style="background-color:#FAFAD2">
  </colgroup>
  <tr>
    <th>ISBN</th>
    <th>Title</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>HTML Basics</td>
    <td>$53</td>
  </tr>
</table>

Try It Yourself

Syntax

<col span="number">

Attribute Value

Value Description
number Set the number of columns to span for the <col> element.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support