Idocs Guide to 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 Mutisya 1493
Shalom Buraka 3829
Hallie Curry 8372
Shari Silberglitt 4827

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=2>
<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 Mutisya 1493
Shalom Buraka 3829
Hallie Curry 8372
Shari Silberglitt 4827

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

Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.