The Mudcat Café TM
Thread #31267   Message #405992
Posted By: MudGuard
25-Feb-01 - 12:13 PM
Thread Name: HTML Tables
Subject: RE: HTML Practice Thread....again
colspan is an attribute of the td tag. It allows a table cell to span some columns. See table 1

table 1
cell1cell2cell3
cell4 with colspan=2cell5

You can also use rowspan (see table 1).

table 2
cell1 with rowspan=2cell2
cell3
cell4cell5

Or combine both (see table 3)
table 3
cell1 with rowspan=2 and colspan=2cell2
cell3
cell4cell5cell6

cellpadding controls the distance between a cell's border and the content. For the first table I set it to 0, for the second to 20.

cellspacing controls the distance between borders. (table 4 uses 0, table 5 uses 20)

table 4
cell1cell2
cell3 with colspan=2

table 5
cell1cell2
cell3 with colspan=2

To control column width you can either set width within the td tag or insert a colgroup tag:
<table>
<colgroup>
<col width=200>
<col width=500>
</colgroup>
<tr><td> ...
You can use span in the col tag to get columns of the same width as in
<table>
<colgroup>
<col width=200>
<col span=3 width=500>
</colgroup>
<tr><td> ...
gives you a table with one column of 200pixels and 3 of 500 pixels width.