HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<col> (Column)

This element defines a column within a table and is used for grouping and alignment purposes. It generally is found within a <colgroup> element.

Standard Syntax

align="center | char | justify | left | right"
class="class name(s)"
dir="ltr | rtl"
id="unique alphanumeric identifier"
lang="language code"
style="style information"
title="advisory text"
valign="baseline | bottom | middle | top"
width="column width specification" />

Attributes Defined by Internet Explorer

bgcolor="color name | #RRGGBB" (5.5)

Standard Events

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

Events Defined by Internet Explorer

onlayoutcomplete, onreadystatechange

Element Specific Attributes

This attribute specifies horizontal alignment of a cell's contents.

Applies a background color to all cells in the column (IE 5.5 only).

This attribute is used to set the character to align the cells in a column on. Typical values for this include a period (.) when attempting to align numbers or monetary values.

This attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char value.

When present, this attribute applies the attributes of the <col> element to additional consecutive columns.

This attribute specifies the vertical alignment of the text within the cell. Possible values for this attribute are baseline, bottom, middle, and top.

This attribute specifies a default width for each column in the current column group. In addition to the standard pixel and percentage values, this attribute might 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. Relative widths such as 0.5* also can be used.


<table border="1" width="400">


<col align="center"width="150" />
<col align="right" />

  <td>This column is aligned to the center.</td>
This one is aligned to the right.</td>







HTML 4, 4.01, XHTML 1.0, 1.1, Basic
Internet Explorer 4, 5, 5.5, 6
Netscape 6, 7 Opera 7


Under XHTML 1.0, <col> requires a trailing slash: <col />.

This element should appear within a colgroup element, and like that element, it is somewhat of a convenience feature used to set attributes with one or more table columns. In practice, few developers seem to use it.

(X)HTML Elements
CSS Properties
Previous: code Next: colgroup
< Home | About | Chapters | Examples | Errata | Reference | Site Map >