HTML <col> span Attribute

The span attribute on a <col> element specifies the number of columns the element spans, i.e. extends.

Example

#

A span attribute on a <col> element.
Two spanned columns are styled with a background color.

Name Age Country
Christina Berglund 35 Sweden
Maria Larsson 27 Sweden
<style>
  table.tb { width: 350px; border-collapse: collapse; }
  .tb th, .tb td { padding:5px; border: 1px solid #777; }
</style>

<table class="tb">
  <colgroup>
    <col span="2" style="background-color:aliceblue;">
  </colgroup>
   <tr> 
      <th>Name</th>
      <th>Age</th>
      <th>Country</th>
   </tr>
   <tr> 
      <td>Christina Berglund</td>
      <td>35</td>
      <td>Sweden</td>
   </tr>
   <tr> 
      <td>Maria Larsson</td>
      <td>27</td>
      <td>Sweden</td>
   </tr>
</table>

Using span

The span attribute specifies the number of columns the <col> element spans, i.e. extends.

This setting is useful for applying a style to multiple columns.


Syntax

<col span="number">

Values

#

Value Description
number Number of columns the <col> extends.

Browser support

Here is when span support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <col>
Guides