X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML <colgroup> span Attribute

HTML colgroup Tag Reference HTML <colgroup> tag

Example

Set the background color of the first two columns using the <colgroup> span attribute:

<table>
  <colgroup span="2" style="background:red"></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>
  <tr>
    <td>5869207</td>
    <td>My first CSS</td>
    <td>$49</td>
  </tr>
</table>

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The span attribute is supported in all major browsers.


Definition and Usage

The span attribute defines the number of columns a <colgroup> element should span.

Tip: To define different properties to a column within a <colgroup>, use the <col> tag within the <colgroup> tag.


Differences Between HTML 4.01 and HTML5

NONE.


Syntax

<colgroup span="number">

Attribute Values

Value Description
number Sets the number of columns a column group should span


HTML colgroup Tag Reference HTML <colgroup> tag

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook