Dynamic HTML Tips: How To Create TABLE
How to
build a table step-by-step by using the example table below.
This is caption.
This is header.
The letters in this section are bold.
We are bold because we are in tag.
means Table Header.
| This cell is wider than others because the colspan
was set = 2. |
This is ordinary text in ordinary cell. |
This cell has more vertical space because the
rowspan was set = 2. |
| This is ordinary text in ordinary cell. |
This is ordinary text in ordinary cell. |
This text is right/bottom align. |
Here is the HTML code that makes
this table; here also is a description of what the code does. Following this
example, you will understand the basic rules and be able to build your own
table.
The border of the table was specified as 1
pixel. If you want an invisible table border, just set it to 0.
Cellpadding (spacing within cells
themselves) = 5 pixels. Cellspacing (spacing between each cells) =
5 pixels.This is
caption.Caption tag show the caption above the
table.Telling a browser that we are opening a
table\'s row.This is headerThe letters in this
sectionare bold.We are bold because
we arein <TH> tag.<TH> means
TableHeader tag refers to "Table Header".
Characters within this tag will be shown bold. Like the | tag, the |
tag can have the value of background color specified. This is not in the
HTML 3.2 standard, but this additional attribute is supported by both
Netscape and Explorer. You can also put background="your_image.gif" as a
background, but only Explorer supports table background. Close the row.Open new row| This cell is wider than
othersbecause the colspan was set = 2. | This is ordinary text in ordinary
cell. | This cell has more
vertical spacebecause the rowspan was set = 2. | = table data. COLSPAN is the number
of columns spanned by the cell. ROWSPAN is the number of rows spanned by
the cell. Both have a default at 1. | Close the row.Open new row| This is ordinary text in ordinary
cell. | This is ordinary text in ordinary
cell. | This
text is right/bottom align. | ALIGN is for horizontal. Its default value
is "left". VALIGN is for vertical. Its default value is "middle".
Now you know the basics of how to
build a table and what its attributes are. You may adjust and use the table in
many circumstances.
|