Welcome to ITM Web100 Training Program


Lesson 4

Tables and Frames

Time to get started with tables.

Basic Tables

Column One Header Column Two Header
Row One/Column One Row One/Column Two
Row Two/Column One Row Two/Column Two

OPENING/CLOSING TAG DESCRIPTION
<TABLE>...</TABLE> Specifies an HTML table. (By default the table will have no borders)
<TR>...</TR> Specifies a Table Row
<TH>...</TH> Specifies a Table Header Cell
<TD>...</TD> Specifies a Table Data Cell

<HTML>
<HEAD>
<TITLE>Table Example</TITLE>
</HEAD>
<BODY>
<TABLE>

<TR>
<TH>Column One Header</TH>
<TH>Column Two Header</TH>
</TR>

<TR>
<TD>Row One/Column One</TD>
<TD>Row One/Column Two</TD>
</TR>

<TR>
<TD>Row Two/Column One</TD>
<TD>Row Two/Column Two</TD>
</TR>
</TABLE>
</BODY>
</HTML>

<TD><B>This text is bold</B></TD>

Table Attributes

ATTRIBUTE DESCRIPTION
ALIGN Specifies the position of the table with respect to the document. This works the same as the ALIGN parameter for images. Valid values include LEFT, CENTER and RIGHT.
BGCOLOR Colors the table background just as it would when used with the <BODY> tag.
BORDER Specifies the pixel width of the border that divides table cells and the table itself. This table is set to BORDER = "0".
CELLPADDING Specifies the amount of space between the borders of a table and the actual data in the cell.
CELLSPACING Specifies the amount of space inserted between table cells.
HEIGHT Specifies the height of the table in absolute pixels or as a percentage of the available space.
WIDTH Specifies the width of the table in absolute pixels or as a percentage of the available space

Tables by Example

Column One Header Column Two Header
Row One/Column One Row One/Column Two
Row Two/Column One Row Two/Column Two

<TABLE>

<TR>
<TH>Column One Header</TH>
<TH>Column Two Header</TH>
</TR>

<TR>
<TD>Row One/Column One</TD>
<TD>Row One/Column Two</TD>
</TR>

<TR>
<TD>Row Two/Column One</TD>
<TD>Row Two/Column Two</TD>
</TR>
</TABLE>
Column One Header Column Two Header
Row One/Column One Row One/Column Two
Row Two/Column One Row Two/Column Two

<TABLE BORDER = "4">


Column One Header Column Two Header
Row One/Column One Row One/Column Two
Row Two/Column One Row Two/Column Two

<TABLE BORDER = "4" CELLPADDING = "10">


Column One Header Column Two Header
Row One/Column One Row One/Column Two
Row Two/Column One Row Two/Column Two

<TABLE BORDER = "4" CELLPADDING = "10"
            CELLSPACING = "10">


Column One Header Column Two Header
Row One/Column One Row One/Column Two
Row Two/Column One Row Two/Column Two

<TABLE BORDER = "4" BGCOLOR = "YELLOW">


Column One Header Column Two Header
Row One/Column One Row One/Column Two
Row Two/Column One Row Two/Column Two

<TABLE BORDER = "4" WIDTH = "100">


Column One Header Column Two Header
Row One/Column One Row One/Column Two
Row Two/Column One Row Two/Column Two

<TABLE BORDER = "4" WIDTH = "80%">


More Info about Tables

Lesson 4