HTML | PHP | Forum

HTML <colgroup> tag


<colgroup> - </colgroup>

Definition and Usage

The COLGROUP element creates a column group, a structural division within a table that can be appointed attributes with style sheets or HTML. A table may inlude more than one column group.

If used, COLGROUP must be after the optional CAPTION and before the optional THEAD in the TABLE. The structural divisions defined by COLGROUP allow authors to easily suggest a presentation for groups of columns through style sheets.

Optional Attributes

Attribute Value Description
align right
Defines the horizontal alignment of the contents in the column group
char character Defines a character to use to align text on (use with align="char")
charoff pixels
Defines an alignment offset to the first character to align on, as set with char
span number Defines the number of columns the <colgroup> should span
valign top
Defines the vertical alignment of the contents in the column group
width %
Defines the width of the column group.

Note: The width attribute can be overridden by settings in <col>

Standard Attributes

id, class, title, style, dir, lang, xml:lang

For a full description, go to Standard Attributes.

Event Attributes

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

For a full description, go to Event Attributes.


Source Output
This example shows a table that uses <colgroup>:
<table border="2">
<colgroup span="4">
This example shows a table that uses colgroup:
1 2 3 4


Learn HTML
HTML Tutorial

HTML Reference
HTML by function
HTML by Alphabet

HTML events
HTML attributes
HTML color names

<h1> to <h6>


Copyright 2005-8 Sunilcare.  All Rights Reserved.
Comments or suggestions? Contact us.About us