HTML and CSS Reference
In-Depth Information
Element-Specific Attributes
align
This attribute specifies horizontal alignment of the 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 attempts 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 on which the cells in a column should be
aligned. A typical value for this attribute is a period (
.
) for aligning numbers or monetary
values.
charoff
This attribute is used to indicate the number of characters by which the column
data should be offset 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>
tags. 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 can
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="2" align="char" char=":" valign="center">
<col /><col /><col />
</colgroup>
<colgroup style="background-color: green;">
<col align="left" />
<col align="center" />
</colgroup>
Compatibility
HTML 4, 4.01, 5
XHTML 1.0, 1.1
Firefox 1+, Internet Explorer 4+,
Netscape 6+, Opera 7+, Safari 1+
Notes
• Each column group defined by a
<colgroup>
tag can contain zero or more
<col>
tags.
• Under XHTML 1.0, the closing
</colgroup>
tag is mandatory.