Chapter 9: Tables
index | previous | next

Creating a Simple Table

Tables are made up of rows of cells. The number of cells in each row determine the table’s shape.

To create a simple table:

  1. Type <TABLE>.
  2. Type <TR> to define the beginning of the first row. If desired, press Return and Tab to visually distinguish the row elements.
  3. Type <TD> to define the beginning of the cell.
  4. Type the contents of the cell.
  5. Type </TD> to complete the cell.
  6. Repeat steps 3–5 for each cell in the row.
  7. Type </TR> to complete the row.
  8. Repeat steps 2-7 for each row.
  9. To finish the table, type </TABLE>.

Tips

  • The </TABLE> tag is not optional. Netscape won’t display tables without it.
  • Officially, you can omit the closing tag for cells (</TD>) and rows (</TR>). However, leaving them out makes some browsers display extra spaces between cells.
  • There is also a TH tag for creating header cells. But, all it does is center the contents of a cell and format it in boldface. If you’re mostly using tables to help layout your page, TH is not very useful.
  • You can create a caption for the table in opening and closing CAPTION tags. use ALIGN=direction, where direction is top, bottom, left, or right to align the caption. Personally, I think it's ugly and not very useful for layout purposes.
Figure 9.3 This very simple table has two rows, each of which has only one cell. Notice that I’ve added extra size formatting to the caption to keep it unobtrusive.
Figure 9.4 A simple table like this is a great way to keep a photo and its caption forever joined.
previous | next