Building Tables
You have many options when you are building tables, for the final output. So, what I will
do here is list each attribute to begin with, then show some examples of actual tables,
with the code attached to them.
TABLE---Tag:<TABLE> </TABLE>
Defines the beginning < TABLE > and the ending < /TABLE > of a table
structure.*
BORDER---Tag:<TABLE BORDER> </TABLE>
Turns the table border on, and sets a depth for the border. For instance, the acutal table
this text is written on has a <TABLE BORDER=5>.*
CELLPADDING---Tag:<TABLE CELLPADDING= > </TABLE>
Specifies the thickness of the lines between cells.*
CELLSPACING---Tag:<TABLE CELLSPACING=> </TABLE>
Specifies the spacing between cells.*
WIDTH---Tag:<TABLE WIDTH= > </TABLE>
Specifies in pixels, the width of the table.*
*All the attributes with a red asterisk can be
combined into one line of code as follows:
<TABLE BORDER=5 CELLPADDING=0 CELLSPACING=0 WIDTH=550>
Then you would just add your </TABLE> ending code at the end of the
table once.
TABLE ROW---Tag:<TR> </TR>
Defines a row in a table. You can use the align and the valign attributes with
this tag.
TABLE CELL---Tag:<TD> </TD>
Defines the actual cell. You can do many things here also. The align, valign, colspan,
rowspan, width, and cell color attributes can be used in a table cell.
TABLE CAPTION---Tag:<CAPTION> </CAPTION>
Causes a header or footer so to speak.
Table #1 This
is a simple table. |
Row 2, Cell 1 |
Row 2, Cell 2 |
Row 2, Cell 3 |
Row 3, Cell 1 |
Row 3, Cell 2 |
Row 3, Cell 3 |
Code for Table #1
<center>
<table border=10 cellpadding=5 cellspacing=5 width=400
bgcolor="#eeebee">
<tr>
<td colspan=3 align=center>
TABLE #1 This is a simple table!
</td>
</tr>
<tr>
<td>
Column One, Row 1
</td>
<td>
Column Two, Row 1
</td>
<td>
Column Three, Row 1
</td>
</tr>
<tr>
<td>
Column 1, Row 2
</td>
<td>
Column 2, Row 2
</td>
<td>
Column 3, Row 2
</td>
</tr>
</table>
</center>
Try to keep your tags together. One of the most frequent questions I get asked is why
doesn't my table work? One of the most frequent reasons is that the tags don't match,
i.e., a beginning tag and no ending tag. You must have a beginning to match every ending
and vice versa.
|
Table #2 This
is a little more Complex |
| This will span three rows and one
column. |
Row 2, Cell 2 |
Row 2, Cell 3 |
Row 2, Cell 4 |
Row 3, Cell 2 |
Row 2, Cell 3 |
Row 3, Cell 4 |
Row 4, Cell 2 |
Row 4, Cell 3 |
Row 3, Cell 4 |
Code for Table #2
<center>
<table border=10 cellpadding=5 cellspacing=5 width=400
bgcolor="#eeebee">
<tr>
<td colspan=4 align=center>
TABLE #2 This is a little more complex!
</td>
</tr>
<tr>
<td rowspan=3>
This will span 3 rows and one column!
</td>
<td>
Row 2, Column 2
</td>
<td>
Row 2, Column 3
</td>
<td>
Row 2, Column 4
</td>
</tr>
<tr>
<td>
Row 3, Column 2
</td>
<td>
Row 3, Column 3
</td>
<td>
Row 3, Column 4
</td>
</tr>
<tr>
<td>
Row 4, Column 2
</td>
<td>
Row 4, Column 3
</td>
<td>
Row 4, Column 4
</td>
</tr>
</table>
</center> |
|