Tables are by far one of the best HTML statements ever created. The ability to format a web page with table statements is amazing! Learn 'em, use 'em, and love 'em!
Eggs | $0.79 |
Milk | $2.59 |
Bread | $1.29 |
Soda | $1.19 |
This is the code that made it happen. The actually code is on the left and the English description is on the right. The description is indented in order to show the "structure" of the table statement.
<TABLE> <TR> <TD>Eggs</TD> <TD>$0.79</TD> </TR> <TR> <TD>Milk</TD> <TD>$2.59</TD> </TR> <TR> <TD>Bread</TD> <TD>$1.29</TD> </TR> <TR> <TD>Soda</TD> <TD>$1.19</TD> </TR> </TABLE> |
Start Table Start Row Table Data Table Data End Row Start Row Table Data Table Data End Row Start Row Table Data Table Data End Row Start Row Table Data Table Data End Row End Table |
Confused? Ok, lets take a look at the table above. This table is actually pretty simple. You build tables very much the same way you read a book; from left to right and from top to bottom. The table begins with a <TABLE> tag and ends with a </TABLE> tag. Each row begins with a <TR> tag and ends with a </TR> tag. Each piece of table data begins with a <TD> tag and ends with a </TD> tag.
But, that's not a table, you say! It doesn't have a border! Actually, it is a table. It's a table with no border or a BORDER="0". This concept is very important when you want to use TABLE statements to format your web pages. You don't always want a thick border. Ok, so lets make a table with a BORDER this time.
Eggs | $0.79 |
Milk | $2.59 |
Bread | $1.29 |
Soda | $1.19 |
The only difference between this table and the previous is the <TABLE> statement which looks like the following.
Pretty easy, hu? The size of the border is represented in pixels. Ok, now lets get a little more CELLSPACING. That is the spacing between our table cells. You can also think of this as the wall thickness between table cells.
Eggs | $0.79 |
Milk | $2.59 |
Bread | $1.29 |
Soda | $1.19 |
That looks much better. Can you see the difference? Again the only change is in the <TABLE> statement which looks like the following.
The CELLSPACING, like the BORDER, is also measured in pixels. But, the text looks too close to the table walls, you say! Ok, ok, we can fix that too. It's called CELLPADDING. It's the space between the cell contents and the edges of the cell walls.
Eggs | $0.79 |
Milk | $2.59 |
Bread | $1.29 |
Soda | $1.19 |
Ah, now is that the way you wanted? No? Well, I had to exaggerate the numbers a bit, but that was only to try and make a point. I hope you can see the differences. The previous table was created with the <TABLE> statement shown below.
![]() |
Pretty cool artwork, it even makes my nasty picture look good. Here's the code that made it.
Or you can also frame your pictures with text as shown below.
![]() |
What a Masterpiece! |
Netto, hu! The code is shown below.
Shareware.com | NBA |
NASA/KSC | CNN Newws |
Here's the code that did it.
Well, I hope you have enjoyed this little section on the <TABLE> statement. There's
a whole lot more you can do with the <TABLE> statement than what is possible in
this tutorial. Still, I hope this has helped.