HTML and CSS Reference
In-Depth Information
charoff
This attribute is used to indicate the number of characters by which the column
data should be offset from the alignment characters specified by the
char
value.
span
When present, this attribute applies the attributes of the
col
element to additional
consecutive columns.
valign
This attribute specifies the vertical alignment of the text within the cell. Possible
values for this attribute are
baseline
,
bottom
,
middle
, and
top
.
width
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.
Example
<table border="1" width="400">
<colgroup>
<col align="center" width="150" />
<col align="right" />
</colgroup>
<td>
This column is aligned to the center.
</td>
<td>
This one is aligned to the right.
</td>
</td>
<tr><td>
!
</td><td>
?
</td></tr>
<tr><td>
!
</td><td>
?
</td></tr>
</table>
Compatibility
HTML 4, 4.01, 5
XHTML 1.0, 1.1
Firefox 1+, Internet Explorer 4+,
Netscape 6+, Opera 7+, Safari 1+
Notes
• Under XHTML 1.0 and XHTML5,
<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.
<colgroup> (Table Column Group)
This element creates an explicit group of table columns containing
col
elements to provide
for table column-level scripting or formatting.
Standard Syntax
<colgroup
align="center | char | justify | left | right"
char="character"