Please note, this is a STATIC archive of website from 10 Sep 2022, does not collect or store any user information, there is no "phishing" involved.

HTML <colgroup> Tag

Topic: HTML5 Tags ReferencePrev|Next


The <colgroup> (short for column group) tag defines a group of one or more columns within a table. The <colgroup> element can only be used inside a <table> element, after <caption> element and before the <thead>, <th>, <tfoot>, <tbody>, and <tr> elements.

The following table summarizes the usages context and the version history of this tag.

Parent: <table>
Content: 0 or more <col> elements
Start/End Tag: Start tag: required, End tag: required
Version: HTML 4, 4.01, 5


The basic syntax of the <colgroup> tag is given with:

HTML / XHTML: <colgroup> ... </colgroup>

The example below shows the <colgroup> tag in action.

        <col style="background-color:#adff2f;">
        <col span="2" style="background-color:#f0e68c;">
        <td>John Carter</td>
        <td>Peter Parker</td>
        <td>John Rambo</td>

Tag-Specific Attributes

The following table shows the attributes that are specific to the <colgroup> tag.

Attribute Value Description
align left
Obsolete Specifies the horizontal alignment of content within each cell of a column group.
char character Obsolete Sets the character to which cell contents should align in a column group.
charoff number Obsolete Defines the number of characters by which cell contents will be offset from the alignment characters specified by the char attribute.
span length Specifies the number of columns in a column group. If not present, its default value is 1. Negative value is not allowed.
valign top
Obsolete Specifies the vertical alignment of content within each cell of a column group.
width length Obsolete Specifies a default width for each column in the current column group.

Global Attributes

Like all other HTML tags, the <colgroup> tag supports the global attributes in HTML5.

Event Attributes

The <colgroup> tag also supports the event attributes in HTML5.

Browser Compatibility

The <colgroup> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 4+
  • Apple Safari 1+
  • Opera 7+

Further Reading

See tutorial on: HTML Tables.

Related tags: <col>, <table>.

Bootstrap UI Design Templates