|
COLGROUP - Table Column Group
The COLGROUP element defines a column group in a table. If used, COLGROUP must be after the optional CAPTION and before the optional THEAD in the TABLE. The structural divisions defined by COLGROUP allow authors to easily suggest a presentation for groups of columns through style sheets. COLGROUP's SPAN attribute defines the number of columns in the group; the default value is 1. A number of other attributes are permitted on COLGROUP, and these are shared among the cells of the group. COLGROUP may contain COL elements that define attributes for the cells of individual columns, overriding attributes defined for the column group. The SPAN attribute should not be used if the COLGROUP contains any COL elements. The next example features three column groups to structurally divide the table into three parts. The first part is a single column that gives the description of a character. The second part consists of three columns giving different ways of representing the character in HTML. The third part consists of three columns with renderings of the character in the user's browser.
In place of the <COLGROUP SPAN=3> tag in the preceding example, a COLGROUP with three COL elements could have been used:
Here we have used the CLASS attribute to distinguish the individual columns of the group, allowing us to easily suggest different presentations for the columns through style sheets. COLGROUP also takes a number of presentational attributes, many of which cannot be completely replaced by style sheets. Since few browsers support COLGROUP, authors may wish to specify these attributes on the TD or TH elements instead. The WIDTH attribute specifies a width for each column in the group. The value must be a number in pixels, a percentage of the table width, or a relative length expressed as i* where i is an integer. A column with WIDTH="3*" will be allotted three times the width of a column with WIDTH="1*". The value 0* is equivalent to the minimum width necessary for the column's contents. The ALIGN attribute specifies the horizontal alignment for each cell in the column group. Possible values are left, center, right, justify, and char. ALIGN=char aligns a cell's contents on the character given in the CHAR attribute. The default value for the CHAR attribute is the decimal point of the current language--a period in English. The CHAROFF attribute specifies the offset to the first occurrence of the alignment character. The attribute's value is a number in pixels or a percentage of the cell's width; CHAROFF="50%" centers the alignment character horizontally in a cell. The VALIGN attribute specifies the vertical position of a cell's contents. Possible values are:
More Information |
|||||||||||||||||||||||||
With any suggestions or questions please feel free to contact us |