Site hosted by Angelfire.com: Build your free website today!

General help index
help forums
Read our FAQ

HTML reference index
Home
basic HTML tags
HTML hyper links
HTML lists
placing images
HTML tables

CSS reference index
Intro to CSS

Site Promotion
submit to search engines
meta tag generator
html solved search

contact me

HTML tables.


Uses for HTML tables

HTML tables can be used in many ways the main purpose is to create a page layout.
Others include menu's , to contain an image or just to contain some text you want to be seperated from the rest of the page.

Table tags

HTML tables have a few basic tags that have to be included in a table below is an example of these:

<table> is the start of a table and all tables must end with the </table> tag.
The <tr> tag is also known as a table row and also must end with the </tr> tag.
Then there is the <td> tag which actually means table cell and as with the other tags must end with </td>.

The other tag in HTML tables is <th> which means table header and also ends with the </th>.

How to use table tags

Ok now in order to make a table using the tags above you must know how to place the tags below is the code to make a simple table and then the table it makes:

<table>
<tr>
<td>
cell 1</td>
<td>
cell 2</td>
</tr>
<tr>
<td>
cell 3</td>
<td>
cell 4</td>
</tr>
</table>

cell 1 cell 2
cell 3 cell 4

Now I will show how to add a border and a background color.

To add a border simply change the <table> to <table border="2"> and below is the result on the table:

cell 1 cell 2
cell 3 cell 4

And to change the background color simply change the <table> to <table bgcolor="#4dcb01"> and the result would be:

cell 1 cell 2
cell 3 cell 4

You can change both the border and background color in one go by adding both the attributes to the <table> tag and the result would be:

cell 1 cell 2
cell 3 cell 4

Changing the color of a table cell

Changing the color of a table cell is easy all it takes is an extra attribute added to the <td> tag.

Below is the attribute that needs to be added:

<td bgcolor="#4dcb01">
Using that attribute would make a table look like this:

cell 1 cell 2
cell 3 cell 4

Using the table heading

Table headings are very very simple to use simply add the <th> tag straight after the <table> and must end with the </th> tag and the result would be:

heading 1heading 2
cell 1cell 2
cell 3cell 4


copyright © 2000-2001 Richard Brown