Make your own free website on Tripod.com

Making Tables
By Kushinator

      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!


Basic Tables:

      Let us take our grocery list that we used in the list tutorial and make it into a table this time. We'll place the items in the first column and the prices in the second column.

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.

       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.


Framing Images:

      Now we want to get into the more fun stuff. Framing images is a great way of enhancing your pictures. It makes them seem to jump right out of the page. Here is my 5 second masterpiece.

Pretty cool artwork, it even makes my nasty picture look good. Here's the code that made it.

       Notice that in this case I left out the <TR> tag and the </TR> tag. It still works just fine. HTML purists will probably argue that these tags need to be in there. If you feel that way, as I usually do, then use them.

Or you can also frame your pictures with text as shown below.

What a
Masterpiece!

Netto, hu! The code is shown below.

I have one more note on framing images. If your having problems centering your image try the following.



Framing Links:

      You can also put links inside a table. In fact you can put your whole page inside a bunch of table commands if you want to and by using BORDER="0" no one could really tell. Why would you want to do that, you ask? For formatting images and text together on your page; think about it. Ok, back to the link framing.

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.