NOTICE: This website is no longer updated or supported - as such many of the techniques used to build it may seem antiquated in the modern day. It is preserved for historical reasons only.

HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<colgroup> (Column Group)

This element creates an explicit column group to access a group of table columns for scripting or formatting.

Standard Syntax

align="center | char | justify | left | right"
class="class name(s)"
dir="ltr | rtl"
id="unique alphanumeric identifier"
lang="language code"
style="style information"
title="advisory text"
valign="baseline | bottom | middle | top"
width="column width specification"

<col> elements only


Attributes Defined by Internet Explorer

bgcolor="color name | #RRGGBB" (5.5)

Standard Events

onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

Events Defined by Internet Explorer


Element Specific Attributes

This attribute specifies horizontal alignment of contents of the cells in the column group. The values of center, left, and right have obvious meanings. A value of justify for the attribute should attempt to justify all the column's contents. A value of char attempts to align the contents based on the value of the char attribute in conjunction with charoff.

This Internet Explorer-specific attribute sets the background color for the columns in the column group. Its value can be either a browser-dependent named color or a color specified using the hexadecimal #RRGGBB format.

This attribute is used to set the character to align the cells in a column on. Typical values for this include a period (.) when attempting to align numbers or monetary values.

This attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char value.

When present, this attribute specifies the default number of columns in this group. Browsers should ignore this attribute if the current column group contains one or more <col> elements. The default value of this attribute is 1.

This attribute specifies the vertical alignment of the contents of the cells within the column group.

This attribute specifies a default width for each column and its cells in the current column group. In addition to the standard pixel and percentage values, this attribute might take the special form 0*, which means that the width of each column in the group should be the minimum width necessary to hold the column's contents.


<colgroup span="10" align="char" char=":" valign="center">

<colgroup style="background: green">
<col align="left">
<col align="center">


HTML 4, 4.01, XHTML 1.0, 1.1, Basic
Internet Explorer 4, 5, 5.5, 6
Netscape 6, 7
Opera 7


Each column group defined by a <colgroup> can contain zero or more <col> elements.

Under XHTML 1.0, the closing </colgroup> tag is mandatory.

(X)HTML Elements
CSS Properties
Previous: col Next: comment
< Home | About | Chapters | Examples | Errata | Reference | Site Map >