Table Headers
You can also use the <TH> tag instead of the <TD> tag to add a heading to your table columns, in the following way:
<TH>Creatures</TH>
<TABLE BORDER="1">
<TR>
<TH>Creature</TH>
<TH>Size</TH>
</TR>
<TR>
<TD>Tyrannosaurus Rex</TD>
<TD>Biggest</TD>
</TR>
<TR>
<TD>Elephant</TD>
<TD>Big</TD>
</TR>
<TR>
<TD>Ant</TD>
<TD>Small</TD>
</TR>
</TABLE>
| Creature |
Size |
| Tyrannosaurus Rex |
Biggest |
| Elephant |
Big |
| Ant |
Small |
NOTE: It's very easy to loose track of the different parts of your HTML when making a table. Here's a couple of tricks to help keep things clear.
- Try to put the HTML for each table cell on a separate line and to indent the text so that you can easily see the different parts of your table.
- Keep your border value at 1 so that you can see the layout you are making, if you don't want to see the borders in your final page, change it to 0 when the layout is finished.
© 2003 Ashley Preston
|