Basics of Tables in HTML
The basic structure of HTML for tables is:
<table border=6 cellspacing=10 cellpadding=4>
<!--First Row-->
<tr>
<td>First Cell in First Row</td>
<td>Second Cell in First Row</td>
<td>Third Cell in First Row</td>
<td>Fourth Cell in First Row</td>
</tr>
<!--Second Row-->
<tr>
<td>First Cell in Second Row</td>
<td>Second Cell in Second Row</td>
<td>Third Cell in Second Row</td>
<td>Fourth Cell in Second Row</td>
</tr>
<!--Third Row-->
<tr>
<td>First Cell in Third Row</td>
<td>Second Cell in Third Row</td>
<td>Third Cell in Third Row</td>
<td>Fourth Cell in Third Row</td>
</tr>
</table>
which produces:
| First Cell in First Row |
Second Cell in First Row |
Third Cell in First Row |
Fourth Cell in First Row |
| First Cell in Second Row |
Second Cell in Second Row |
Third Cell in Second Row |
Fourth Cell in Second Row |
| First Cell in Third Row |
Second Cell in Third Row |
Third Cell in Third Row |
Fourth Cell in Third Row |
The adjustments one can make in the table tag are:
- border=x thickness in pixels of the beveled edge outer margin.
If x=0 then the table has no visible cell markings. this can be useful
for creative display of text on the screen. As examples, see how
the HTML is constructed in the "About NetScape" page. Tables here are
used for controlling text placement as well as making the TM superscript.
Another good example fo the borderless table is seen on the
WWW developers Virtual Library.
We've used borderless tables on our Director Web
- cellspacing=x thickness of the inner cell dividing lines. If not included
it defaults to 1
- cellpadding=x thickness of the blank space between the cell contents and the cell
margins- i.e. small values will make the text come close to the walls of the table cells.
If not included, the deafult value is 1
There are many other options for modifying the basic structure. You can apply any HTML to
the contents within the cells, including graphics. For more information, see
NetScape's Implementation of Tables,
W3 Consortium's Toward Graceful Deployment of Tables in HTML
or the WWW Developers Virtual Library
Maricopa Center for Learning and Instruction (MCLI)
Maricopa County Community College District, Arizona
The Internet Connection at MCLI is Alan Levine --}
Comments to levine@maricopa.edu