HTML Tutorial: Tables
 
 
Tables - why are they important?

Tables are a very useful way of controlling where text and images are placed on a page, so knowing how to create them is essential. 

Here's a table:

LORD OF THE RINGS
WHO'S AFRAID OF THE BIG BAD WOLF 
HARRY POTTER AND
THE SORCERER'S STONE 

You're probably thinking it doesn't look anything like a table - just wait and see.

Let's start with a table that looks like a table .....

 

The Planets

Mercury Mars
Jupiter Saturn

Simple Table Commands:

Let's look at the HTML that made the table:

<TABLE>
  <TR>
    <TD> Mercury </TD>
    <TD> Mars </TD>
  </TR>
  <TR>
    <TD> Jupiter </TD>
    <TD> Saturn </TD>
  </TR>
</TABLE>

It looks worse than it is... there are in fact only three commands being used over and over again. Lets look at each of them in turn.

<TABLE> this tells the browser to start the table. Everything between this tag and the end table tag </TABLE> is contained within the table.

<TR> short for Table Row - tells the browser to start a new row. </TR> tells the browser to end that row.

<TD> is short for Table Data - not very helpful - I find it more useful to think of it as a "Table Cell" command. <TD> starts the cell and </TD> ends it.

How it works.

Tables (like spreadsheets) are made up of cells organised into rows and columns. The browser creates the table, row by row, starting with the first <TR> command.

How does the browser know how many cells to create in a row? Well for every <TD> command the browser reads, it creates a cell, and it will keep on creating the cells to the right of each other untill it meets an end of line command, i.e </TR>.

 Try it out yourself in the box below ..........