The cover of The Complete Idiot's Guide to Create a Web Page The Complete Idiot's HTML Tag Reference

| Index | Previous Tag: <COL> | Next Tag: <Comments> |


<COLGROUP>

Sets properties for a group of columns within a table.

Support:

HTML StandardInternet ExplorerNetscape Navigator
4.0 and later 3.0 and later Not supported
Notes:
  • This tag must appear before any other table structure tags (such as <TH> or <TR>.
  • To set properties for an individual column, use the <COL> tag.
Attributes:
ALIGN = "Text"
The horizontal alignment of text within each column in the group.

Support:

HTML StandardInternet ExplorerNetscape Navigator
4.0 and later 4.0 and later Not supported

Notes:

  • Possible values: LEFT, CENTER, RIGHT.

BGCOLOR = "Color value"
The color to use for the background of each column in the group.

Support:

HTML StandardInternet ExplorerNetscape Navigator
Not supported 4.0 and later Not supported

Notes:

  • Use either an RGB value or a color name.
  • Try to use a color that's compatible with the color you're using for your column text.

CHAR = "Text (single character)"
The common character upon which each cell in the columns will be aligned.

Support:

HTML StandardInternet ExplorerNetscape Navigator
4.0 and later Not supported Not supported

Notes:

  • The default character is the decimal point.

CHAROFF = Positive integer
The amount of space, in pixels, between each column's left edge and the first occurrence of the character specified by CHAR.

Support:

HTML StandardInternet ExplorerNetscape Navigator
Not supported Not supported Not supported

Notes:

  • If you use the <BDO> tag to change the text direction to right-to-left, then this offset is measured from the right edge of the column.

CLASS = "Text"
The style sheet class used by the tag.

Support:

HTML StandardInternet ExplorerNetscape Navigator
4.0 and later 4.0 and later Not supported

Notes:

  • You can specify two or more classes; be sure to separate each class name with a space.

ID = "Text"
An alphanumeric string that uniquely identifies the tag.

Support:

HTML StandardInternet ExplorerNetscape Navigator
4.0 and later 4.0 and later Not supported

Notes:

  • Although you can use letters and numbers for the ID, the first character must be a letter.

LANG = "Text"
The language used by the tag's attribute values and text content.

Support:

HTML StandardInternet ExplorerNetscape Navigator
4.0 and later 4.0 and later Not supported

SPAN = Positive integer
The number of columns in the group.

Support:

HTML StandardInternet ExplorerNetscape Navigator
4.0 and later 3.0 and later Not supported

Notes:

  • You can use this attribute instead of adding separate <COL> tags.

STYLE = "Text"
The style or styles to use with the tag.

Support:

HTML StandardInternet ExplorerNetscape Navigator
4.0 and later 4.0 and later Not supported

Notes:

  • If you enter multiple style properties, separate each one with a semi-colon (;).

VALIGN = "Text"
The vertical alignment of text within each column.

Support:

HTML StandardInternet ExplorerNetscape Navigator
4.0 and later 4.0 and later Not supported

Notes:

  • Possible values: TOP, MIDDLE, BOTTOM, BASELINE.

WIDTH = Positive integer
Specifies the width, in pixels, of each column in the group.

Support:

HTML StandardInternet ExplorerNetscape Navigator
4.0 and later 4.0 and later Not supported

Example:
<TABLE BORDER>
<COLGROUP ALIGN="LEFT" SPAN=2>    <--This applies to columns one and two
</COLGROUP>
<COLGROUP ALIGN="RIGHT" SPAN=2>   <--This applies to columns three and four
</COLGROUP>
<TH>The first column</TH>
<TH>The second column</TH>
<TH>The third column</TH>
<TH>The fourth column</TH>
<TR>
<TD>Left-aligned</TD>
<TD>Left-aligned</TD>
<TD>Right-aligned</TD>
<TD>Right-aligned</TD>
</TR>
<TR>
<TD>Left-aligned</TD>
<TD>Left-aligned</TD>
<TD>Right-aligned</TD>
<TD>Right-aligned</TD>
</TR>
</TABLE>
How It Looks:
The first column The second column The third column The fourth column
Left-aligned Left-aligned Right-aligned Right-aligned
Left-aligned Left-aligned Right-aligned Right-aligned

| Index | Previous Tag: <COL> | Next Tag: <Comments> |