|
See the navigation bar to
the left? Notice how the text sticks in the
yellow area? It's all done with tables -
they're extremely useful.
<TABLE>
is the table tag. It goes at the top of tables.
<TR> is a table row.
Tables are built by rows.
<TH> is a table header.
These are bolder cells.
<TD> is a table data cell.
Don't forget to
close the tag with </TABLE>,
</TR>, </TH>,
</TD>.
Here's an
example of how you'd make a simple table,
remembering that all rows must have the same
number of cells:
<TABLE>
<TR>
<TH> This is row 1, column 1. It
is a header. </TH>
<TH> This is row 1, column 2. It
is a header. </TH>
</TR>
<TR>
<TD> This is row 2, column 1. </TD>
<TD> This is row 2, column 2. </TD>
</TR>
</TABLE>
What would this look like?
So, that's how
to make a simple table. But what about making a
cell span more than one column or row? Use the
rowspan and colspan attributes, like this:
<TD
ROWSPAN="number of rows to span" COLSPAN="number of columns to span">
This makes a
cell that spans across two rows and three
columns. You must remember to account for the
extra rows and columns!
Then, of course,
you may or may not want your table to have a
border. To do this, set the border attribute in
the <TABLE> tag:
<TABLE
BORDER=0> sets an invisible border.
<TABLE BORDER=1> sets a
thin border.
<TABLE BORDER=3> sets a
thicker border.
<TABLE BORDER=6> sets a
very thick border, and so on.
Here's a table
with a thin border.
|
Here's a table
with a thicker border.
|
Here's a table
with a very thick border.
|
Tables
are useful for all sorts of things. Setting out
pages, showing information and more. They can be
tricky to use, but are very effective when you
do. Good luck, and happy coding!
|