How do I create tables?Tables can be tricky, considering how many different things you can do with them. The thing to remember with tables is that they all follow the same rule, using three main elements: the table command, table data cells and table rows. Once you understand the order you must follow, it doesn't seem quite so complicated.
 Starting OutFirst, for those of you who are unsure what a table is, let me show you what a standard table looks like.
This is a table, although a small one. Tables can be small, like this, or they can be huge, making the basic frameset for a website layout. But for the purposes of this tutorial, I think we'll stick to small. In the above table, there are 4 data cells, and 2 rows. Cell 1 and 2 are in Row 1, and Cell 3 and 4 are in Row 2. Everything about a table can be defined, such as the color of each data cell, the border color and width, etc. The starting code to a table would look like this.
<table><tr><td>
Now keep in mind, this is the bare essentials. You'll want to add certain properties to it to spice it up, such as:
<table border="3" bordercolor="bd0000" bgcolor="white">
What you've basically ordered the webpage to do here is to create a table with a border of 3, specified the border color and background color, then ordered the page to start table row (tr) and start table data cell (td). If you wanted to define a height and width for the table, you would do it like this.
<table border="3" bordercolor="ffffff" bgcolor="white" height="200" width="400">
You can define height and width in pixels or in percentages. For example, in the above, you can see that the width is set to 400 pixels, but if you'd prefer, you can set it to a portion of the page, like "80%". There is also the matter of cellpadding and cellspacing. Cellspacing defines the amount of space between your data cells, and cellpadding defines the amount of space inside the cell from the content to the cell walls. To add cellpadding and cellspacing, the whole thing would look like this.
<table border="3" bordercolor="ffffff" bgcolor="white" height="200" width="400" cellpadding="5" cellspacing="5">
Now lets look at the different elements of a table in easier to understand form.
Okay, so lets review. A basic table, from start to finish, would look like this.
<table border="3" bordercolor="bd0000" bgcolor="white" height="200" width="400" cellpadding="5" cellspacing="5">
 ColspansA colspan is one data cell that stretches out over other data cells. The table below has a colspan.
To add a colspan, you would add it to the data cell that you want stretched. The trick is that that cell now becomes the entire row, so it's important to remember to end the row after that data cell is complete and move on to the next row, like this.
<table>
A colspan doesn't have to be at the top of the table, it can also be displayed like this.
 RowspansA rowspan is one data cell that stretches out over table rows. The table below has a rowspan.
It may look confusing, but basically, when you use a rowspan, you write the data cell for the first row that it occurs in, then never write that data cell again. It will appear in that space for as many rows as you've ordered it to span across. The code for the table above looks something like this.
<table>
 Combining Rowspans & ColspansTake a look at the table below.
The code for the above table looks something like this.
<table>
 Adding a Background ImageYou can add a background image to a table by using this code.
<table style="background-image:url(URL OF IMAGE)">
The result will be something like this.
You can also define an image just to appear in a particular table data cell by using this code for the data cell.
<td style="background-image:url(URL OF IMAGE)">
The result will be something like this.
 Using Tables in LayoutsTake a look at the table below. Now you can see how tables can create the basic layout template for a website. This is a very simple table, with only 2 rows.. one for the colspan data cell, and one for the two side cells and the main content area. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||