Site Development Foundations

Chapter 6 - Introduction to Tables

All tables consist of HTML code defined within <table> and </table> tags. Each table consists of cells ("table divisions") arranged into horizontal rows.

The attributes that can be included with the <table> tag are:

These attributes are explained in more detail in the diagam below.

The <table> ... </table> tags contain

Each cell within the <tr> ... </tr> tags is defined either by

The features of an HTML table

This text area shows the code for an example table, with four rows and four columns. Below that you will see how the table appears. Feel free to change the code in the text area, then click the "Update the screen" button to see the effects. You can click the "Default table" button to restore the original table.

Spanning multiple rows and columns

This cell clearly spans two columns of the table. This is achieved by adding the attribute colspan="2" to the <td> tag for the cell. Although this table has three columns, the first row only has two <td> tags.
This cell clearly spans three rows of the table. This is achieved by adding the attribute <rowspan="3" to the <td> tag for the cell. Subsequent rows will have one fewer <td> tag than might be expected. You can include images in table cells! You can include images in cells! This row has three <td> ... </td> tags.
If you look at the code for this row, you will see there are only two <td> ... </td> tag pairs. The "missing" one is accounted for by the extended cell in the row above. (I couldn't think of anything to write here)
Notice anything about this cell? Yes, I added the bgcolor="white" attribute to the <td> tag. Sneaky, eh! And this time I added the attribute align="center" to the <td> tag.

Previous chapter
Summaries menu
Next chapter
Previous chapter
Summaries menu
Next chapter
Hosted by www.Geocities.ws

1