HTML and CSS

Adding Table Cells

Table cells provide the vertical columns of your table. They are represented by the table data tags:

<td>
</td>

Along with the table and tr elements, the table data element comprises the three essential building blocks of any table (see Example 4-4).

Example 4-4. A table with a single table row and three columns
<table width="90%" border="1" cellspacing="5" cellpadding="5">
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>

Because you have all the necessary building blocks, this table displays in a web browser without any additional help (see Figure 4-5).

Figure 4-5. Anatomy of a simple table: three cells, one row, width of 90%, cellspacing of 5.

Of course, you can add as many table cells as you need for columns. Even better, you can enhance your table cells with table headers, to distinguish the column headers from the column data.