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


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

<col> elements only

</colgroup>

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


onreadystatechange

Element Specific Attributes


align
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.

bgcolor
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.

char
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.

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

span
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.

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

width
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.

Examples


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

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

Compatibility


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

Notes


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 >