HTML Tables Tutorial

Let's begin with a simple and common use for tables: an office phone list. Suppose we have four people whose names we want on the list. The data could be arranged in a table like this:

<TABLE>
<TR> <TD>Raha Mutisya</TD> <TD>1493</TD> </TR>
<TR> <TD>Shalom Buraka</TD> <TD>3829</TD> </TR>
<TR> <TD>Hallie Curry</TD> <TD>8372</TD> </TR>
<TR> <TD>Shari Silberglitt</TD> <TD>4827</TD> </TR>
</TABLE>

Which gives us this table:

Raha Mutisya1493
Shalom Buraka3829
Hallie Curry8372
Shari Silberglitt4827

This table uses the basic three tags all tables must have:

<TABLE ...>
<TABLE ...> creates the table. Most of the overall properties of the table are defined here, such as if it has borders and what is the table's background color.

<TR ...>
<TR ...> (Table Row) defines each row of the table.

<TD ...>
<TD ...> (Table Data) defines each cell of the table.
The first modification we'll make to this little table is to add borders. Borders will help us see how the table is laid out. It's a good idea when designing a table to add borders during the time you design the table, even if you remove them before making the table public.

<TABLE BORDER=1>
<TR> <TD>Raha Mutisya</TD> <TD>1493</TD> </TR>
<TR> <TD>Shalom Buraka</TD> <TD>3829</TD> </TR>
<TR> <TD>Hallie Curry</TD> <TD>8372</TD> </TR>
<TR> <TD>Shari Silberglitt</TD> <TD>4827</TD> </TR>
</TABLE>

which gives us

Raha Mutisya1493
Shalom Buraka3829
Hallie Curry8372
Shari Silberglitt4827

In the next section we'll jazz up the table a little with some headers.

Headers >