There are a number of values that can be applied to cells in tables. When a series of columns will share attributes, it is simpler to establish those values at the beginning of the table, rather than on a cell by cell basis. <colgroup> allows the grouping of columns that share characteristics and <col> allows unique structuring of each column. <col> is always subordinate to <colgroup>.
<col> serves no purpose other than a vehicle to carry attributes to modify the properties of a column.
The table below is used throughout this page as a basis for examples. It is shown in its default state. To view the syntax used, please view the source in your browser. Each attribute and argument is identified by a comment in the form "<!-- attribute= -->".
align=
 |
+ |
2.0 |
3.0 |
3.2 |
4.0? |
 |
0.9 |
1.2 |
|
|
|
|
The "align=" attribute controlls the horizontal alignment of data in a cell.
Communities of Metropolitan Ottawa
| City | population | area | Province | Language |
| Ottawa | 300,000 | 120 sq.mi. | Ontario | many |
| Kanata | 100,000 | 80 sq.mi. | Ontario | English |
| Nepean | 30,000 | 45 sq.mi. | Ontario | English |
| Gloucester | 30,000 | 65 sq.mi. | Ontario | English & French |
| Orleans | 25,000 | 35 sq.mi. | Ontario | English & French |
| Rockcliff | 5,000 | 5 sq.mi. | Ontario | many |
| Vanier | 15,000 | 3 sq.mi. | Ontario | Fremch |
| Hull | 25,000 | 35 sq.mi. | Québec | French |
| Aylmer | 35,000 | 55 sq.mi. | Québec | many |
| Gatineau | 25,000 | 45 sq.mi. | Québec | French |
| Totals | 590,000 | 488 sq.mi. | | |
|
| "left" |
quad left
|
| "right" |
quad right
|
| "center" |
quad center
|
| "justify" |
justified
|
| "char" |
aligned over a specific character defined by "char=" (see below)
|
cellhalign=
 |
+ |
2.0 |
3.0 |
3.2 |
4.0 |
|
Provides control of the horizontal alignment of data in the cells. This is an identical condition to "align=", above, so the purpose of this attribute is not certain.
Communities of Metropolitan Ottawa
| City | population | area | Province | Language |
| Ottawa | 300,000 | 120 sq.mi. | Ontario | many |
| Kanata | 100,000 | 80 sq.mi. | Ontario | English |
| Nepean | 30,000 | 45 sq.mi. | Ontario | English |
| Gloucester | 30,000 | 65 sq.mi. | Ontario | English & French |
| Orleans | 25,000 | 35 sq.mi. | Ontario | English & French |
| Rockcliff | 5,000 | 5 sq.mi. | Ontario | many |
| Vanier | 15,000 | 3 sq.mi. | Ontario | Fremch |
| Hull | 25,000 | 35 sq.mi. | Québec | French |
| Aylmer | 35,000 | 55 sq.mi. | Québec | many |
| Gatineau | 25,000 | 45 sq.mi. | Québec | French |
| Totals | 590,000 | 488 sq.mi. | | |
|
| "left" |
This is total supposition on the part of the author! The specification (HTML 4.0) gives no arguments to this attribute.
|
| "center" |
This is total supposition on the part of the author! The specification (HTML 4.0) gives no arguments to this attribute.
|
| "right" |
This is total supposition on the part of the author! The specification (HTML 4.0) gives no arguments to this attribute.
|
cellvalign=
 |
+ |
2.0 |
3.0 |
3.2 |
4.0 |
|
Controls the vertical alignment of data in the cell. This is an identical condition to "valign=" below, so the purpose of this attribute is unclear, given the lack of arguments in the specification.
|
| "bottom" |
This is total supposition on the part of the author! The specification (HTML 4.0) gives no arguments to this attribute.
|
| "middle" |
This is total supposition on the part of the author! The specification (HTML 4.0) gives no arguments to this attribute.
|
| "top" |
This is total supposition on the part of the author! The specification (HTML 4.0) gives no arguments to this attribute.
|
char=
 |
+ |
2.0 |
3.0 |
3.2 |
4.0 |
|
The "char=" attribute takes a character that specifies the alignment of subsequent text. This is usually used when displaying monetary values. This defaults to the decimal point for the current language. The argument is case sensitive.
|
charoff=
 |
+ |
2.0 |
3.0 |
3.2 |
4.0 |
|
"CHAROFF is a decimal number that specifies the offset for the alignment character from the beginning of the table cell in the DIR direction. Units may be specified using the standard defined units suffixes plus the special suffix of the percent sign indicating the percentage of offset within the cell from the beginning of the cell." (Sandia)
The HTML 4.0 explanation is equally convoluted and since it is unlikely to be supported by most browsers, 'enuf said.
|
| "## en" |
set offset to ## nutts (en spaces - an en space is approximately 1/2 the space of the capital M)
|
| "### pixels" |
set offset to ### pixels
|
| "##%" |
sets offset to ##% of the cell width
|
class=
 |
+ |
2.0 |
3.0 |
3.2 |
4.0 |
|
|
dir=
 |
+ |
2.0 |
3.0 |
3.2 |
4.0 |
|
|
| "ltr" |
|
| "rtl" |
|
id=
 |
+ |
2.0 |
3.0 |
3.2 |
4.0 |
|
|
lang=
 |
+ |
2.0 |
3.0 |
3.2 |
4.0 |
|
|
span=
 |
+ |
2.0 |
3.0 |
3.2 |
4.0 |
 |
0.9 |
1.2 |
|
|
|
|
The argument is a positive integer that specifies how many columns this element applies to, defaulting to one. SPAN="0" implies all the remaining columns from the current column up to and including the last column. If "span=" is missing, each <col> element refers to one column.
Communities of Metropolitan Ottawa
| City | population | area | Province | Language |
| Ottawa | 300,000 | 120 sq.mi. | Ontario | many |
| Kanata | 100,000 | 80 sq.mi. | Ontario | English |
| Nepean | 30,000 | 45 sq.mi. | Ontario | English |
| Gloucester | 30,000 | 65 sq.mi. | Ontario | English & French |
| Orleans | 25,000 | 35 sq.mi. | Ontario | English & French |
| Rockcliff | 5,000 | 5 sq.mi. | Ontario | many |
| Vanier | 15,000 | 3 sq.mi. | Ontario | Fremch |
| Hull | 25,000 | 35 sq.mi. | Québec | French |
| Aylmer | 35,000 | 55 sq.mi. | Québec | many |
| Gatineau | 25,000 | 45 sq.mi. | Québec | French |
| Totals | 590,000 | 488 sq.mi. | | |
|
style=
 |
+ |
2.0 |
3.0 |
3.2 |
4.0 |
|
A text string providing rendering information specific to this element in a notation independent of HTML. (W3)
|
title=
 |
+ |
2.0 |
3.0 |
3.2 |
4.0 |
|
|
valign=
 |
+ |
2.0 |
3.0 |
3.2 |
4.0 |
|
defines the alignment of the text within the table cell
|
| "top" |
|
| "middle" |
|
| "bottom" |
|
| "baseline" |
|
width=
 |
+ |
2.0 |
3.0 |
3.2 |
4.0 |
|
The "width=" attribute specifies the width of each column. There are two philosophies in specifying width, relative and absolute. One column may be fixed and the next can be relative.
The default unit is pixels. A previous specification allowed a suffix on the number with no suffix meaning "pixels" and being the default condition.
Communities of Metropolitan Ottawa
| City | population | area | Province | Language |
| Ottawa | 300,000 | 120 sq.mi. | Ontario | many |
| Kanata | 100,000 | 80 sq.mi. | Ontario | English |
| Nepean | 30,000 | 45 sq.mi. | Ontario | English |
| Gloucester | 30,000 | 65 sq.mi. | Ontario | English & French |
| Orleans | 25,000 | 35 sq.mi. | Ontario | English & French |
| Rockcliff | 5,000 | 5 sq.mi. | Ontario | many |
| Vanier | 15,000 | 3 sq.mi. | Ontario | Fremch |
| Hull | 25,000 | 35 sq.mi. | Québec | French |
| Aylmer | 35,000 | 55 sq.mi. | Québec | many |
| Gatineau | 25,000 | 45 sq.mi. | Québec | French |
| Totals | 590,000 | 488 sq.mi. | | |
|
| "n%" |
This is not listed in the HTML 4.0 arguments list. However, it appears to work. (MSIE 4.0 b 4.71.0544.1)
|
| "n*" |
This is the relative argument. "*" means "variable". If a table in a canvas (the width of a working window) is divided into columns, one can be "2*" (two times) larger than another that carries no relative value or a fixed value (in pixels). If there is no number with the "*", the default is "1" (one).
|
| "ncm" |
suffix meaing centimeters |
| "nem" |
suffix meaning "em"s, the width of the capital letter "M" |
| "nin" |
suffix meaning inches |
| "nmm" |
suffix meaning millimeters |
| "npi" |
A pica is a typesetting unit of measure: there are six pica to the inch and twelve points to one pica. |
| "npt" |
this is a typesetting unit of measure: 1 point is 1/72nd of an inch (one seventy-second of an inch.) |
| "n(px)"
default
|
This is supposed to mean pixel. However, it is seldom used simply because a numeric value without a suffix invariably referrs to pixels. |