HTML Reference Guide


Tag Index| Content List| HTML FAQ

<COL> ... </COL> Table Column

Description:

COL is used to define the generic properties of a table column rather than using the traditional row structure (TR, THEAD, TBODY and TFOOT.) COL is used within a COLGROUP grouping structure to define properties of a single column within the group (attributes specified in the COL element override those found in the parent COLGROUP structure.) It can also be used at the same table structure nesting level as COLGROUP to define properties for single rows (those not participating in a column grouping.)

Attributes:

align - This controls the horizontal alignment of text within the current column.

char - This attribute specifies a character in the cell content to be used to align the data in each cell of the current column (the first occurrence should be used.) The default value for this attribute is the decimal point character for the current specified language.

charoff - This attribute specifies the spacing offset to the first occurrence of the alignment character (specified by the CHAR attribute) on each line of cells in the current column. The direction of the offset is determined by the current text direction (set with the DIR attribute or the BDO element.)

repeat - This attribute specifies how many columns the current column definition applies to. This is a shorthand for providing column attributes to multiple columns at once.

span - This attribute specifies how many columns the current column specification applies to (default value is 1. The number of total columns in a table should equal the number of cells specified later in the table structure, but it is possible to specify a SPAN value of 0, which indicates that the current COL element spans all remaining columns. Using the SPAN element does not actually DEFINE a column grouping, it is rather a method used to more easily specify shared column attributes.

valign - This attribute specifies the vertical alignment of cell contents relative to the cell boundaries for all cells in the current column.

width - Specifies the overall width of the specified column.

Example code:

<table BORDER="2" ALIGN="middle" CELLPADDING="5" BORDERCOLOR="#ff0000" COLS="4" FRAME="vsides" RULES="cols" WIDTH="75%"><colgroup><col ALIGN="right"></colgroup><colgroup><col ALIGN="center"><col ALIGN="center"><col ALIGN="center"></colgroup><caption ALIGN="top">Juggling Capabilities of Waterfront Performers</caption><thead><tr><th>Juggler</th><th>Pins</th><th>Bowling Balls</th><th>Flaming Baseballs</th></tr></thead><tbody><tr><td>Bob</td><td>5</td><td>2</td><td>5</td></tr><tr><td>Larry</td><td>2</td><td>7!!!</td><td>NA</td></tr><tr><td>Julie the Great</td><td>1</td><td>2</td><td>20<br>(She IS great!)</td></tr></tbody></table>

Result:

Juggling Capabilities of Waterfront Performers
JugglerPinsBowling BallsFlaming Baseballs
Bob525
Larry27!!!NA
Julie the Great1220
(She IS great!)

See Also: