TABLES


Tables are the most complicated part of HTML.

Here's an example

One Two
Three Four

What the HTML Means

Width -- Based on the above HTML code, the table is to be 50% of the width of the page when viewed in your browser. Resize the browser, you will see that the table resizes as well.

TR -- The TR represents the table row -- the horizontal rows that construct the table. In this table, there are two rows. There must be a TR, table row, in order to display what goes into the table.

TD -- Within that TR, there must also be a TD, which technically holds the table data. The table data in the example above has the width=50%. This means that the table data is 50% of the width of the table.

TD Width May Vary

One Two
Three Four

TD Alignment

In this example all the sizes are the same, but the data within the table has been aligned differently.

One Two
Three Four

Cellpadding

Here's that same table with a cellpadding that is 5. This means that each cell will have a padding of 5 around the top, bottom, left and right of the data in the cell.

One Two
Three Four

Rowspan and Colspan

What can make tables more complicated is that you can determine the rowspan and the colspan. This, once again, is best explained through demonstration. Here's a slightly different table. This table has three rows and three columns.

One two three
four five six
seven eight nine

Here is the same table with a colspan = 3, which means that the row is to span all three columns.

One
four five six
seven eight nine

The rowspan command works the same way and is great if you want the text in one particular row to take up the entire row.

MY FAVORITE NUMBERS four five six
seven eight nine

Or using colspan, the columns can span all three columns.

MY FAVORITE NUMBERS
four five six
seven eight nine

top of page TABLE OF CONTENTS