|
|
HTML <col> tag
Syntax
<col> - </col>
Definition and Usage
The COL element allows authors to group together
attribute specifications for table columns. The COL
does not group columns together structurally -- that is the
role of the COLGROUP
element. COL elements are empty and serve only as a
support for attributes.
If used, COL must be after the optional CAPTION
and before the optional THEAD
in the TABLE. Unlike COLGROUP,
COL does not group columns structurally; it merely
defines attributes common to all cells in one or more columns.
Optional Attributes
| Attribute |
Value |
Description |
| align |
right
left
center
justify
char |
Defines the horizontal alignment of the
content in the table cell, in the column |
| 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 <col>
should span |
| valign |
top
middle
bottom
baseline |
Defines the vertical alignment of the content
in the table cell, in the column |
| width |
%
pixels
relative_length |
Defines the width of the column.
Note: Overrides the width set in <colgroup>
|
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.
Example
| Source |
Output |
This example shows a table that has three columns of
different widths:
<table border="2">
<colgroup span="3">
<col width="25"></col>
<col width="45"></col>
<col width="65"></col>
</colgroup>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</table> |
This example shows a table that has three columns of different widths:
|
|
|