Idocs Guide to HTML

Table Borders: Between Groups of Columns

In the previous example we set borders between groups of rows. In this page we'll set borders between groups of columns. Like in the previous example, we indicate that the table should have borders between groups with the RULES attribute in the <TABLE ...> tag:

<TABLE BORDER=1 CELLPADDING=4 RULES=GROUPS FRAME=BOX>

To set which columns are grouped together we use the <COLGROUP ...> tag. <COLGROUP ...> takes a little getting used to because it doesn't actually go around any table cells. It goes at the top of the table code where it sets rules about the table columns including which are grouped together. <COLGROUP SPAN="..."> to indicates how many columns are in each group. If you leave SPAN out then it is assumed the group has just one column. So, for example, the following code says that the first column is in a group by itself and the three after that are together in a group. Notice that <COLGROUP ...> requires an end tag. Borders will go only between the groups:

<TABLE BORDER=1 CELLPADDING=4 RULES=GROUPS FRAME=BOX>

<COLGROUP></COLGROUP>
<COLGROUP SPAN=3></COLGROUP>

which gives us this table:

Weekday Date Manager Qty
Monday 09/11 Kelsey 639
Tuesday 09/12 Lindsey 596
Wednesday 09/13 Randy 1135
Thursday 09/14 Susan 1002
Friday 09/15 Randy 908
Saturday 09/16 Lindsey 371
Sunday 09/17 Susan 272

Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.