0% found this document useful (0 votes)
101 views2 pages

Colgroup

The COLGROUP element creates column groups in an HTML table. It can specify the number of columns either through its span attribute or by including multiple COL elements. Using the span attribute is easier when all columns have the same width. A COL element within the COLGROUP can single out a specific column to apply individual styling. The example document demonstrates using COLGROUP and COL elements to create two column groups with different default column widths in a single table.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
101 views2 pages

Colgroup

The COLGROUP element creates column groups in an HTML table. It can specify the number of columns either through its span attribute or by including multiple COL elements. Using the span attribute is easier when all columns have the same width. A COL element within the COLGROUP can single out a specific column to apply individual styling. The example document demonstrates using COLGROUP and COL elements to create two column groups with different default column widths in a single table.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

The COLGROUP element creates an explicit column group.

The number of columns in the column group may be specified in two, mutually exclusive ways: 1. The element's span attribute (default value 1) specifies the number of columns in the group. 2. Each COL element in the COLGROUP represents one or more columns in the group. The advantage of using the span attribute is that authors may group together information about column widths. Thus, if a table contains forty columns, all of which have a width of 20 pixels, it is easier to write:
<COLGROUP span="40" width="20"> </COLGROUP>

than:
<COLGROUP> <COL width="20"> <COL width="20"> ...a total of forty COL elements... </COLGROUP>

When it is necessary to single out a column (e.g., for style information, to specify width information, etc.) within a group, authors must identify that column with a COL element. Thus, to apply special style information to the last column of the previous table, we single it out as follows:
<COLGROUP width="20"> <COL span="39"> <COL id="format-me-specially"> </COLGROUP>

The width attribute of the COLGROUP element is inherited by all 40 columns. The first COL element refers to the first 39 columns (doing nothing special to them) and the second one assigns an id value to the fortieth column so that style sheets may refer to it. The table in the following example contains two column groups. The first column group contains 10 columns and the second contains 5 columns. The default width for each column in the first column group is 50 pixels. The width of each column in the second column group will be the minimum required for that column.

<TABLE> <COLGROUP span="10" width="50"> <COLGROUP span="5" width="0*"> <THEAD> <TR><TD> ...

You might also like