[Next] The Information Commons

4.10.1 TABLE Element

HTML Tables are contained within a TABLE element. The TABLE element denotes the range of the table, and defines properties of it. For example, the attribute BORDER indicates that the table should be drawn with a border around it and between each of the table's cells -- in the notation of tables, each box within the table is called a cell. In fact, BORDER is the only attribute supported by HTML 3 tables. The Netscape Navigator browser supports several other attributes, discussed a bit later.

The only two elements allowed inside a table are CAPTION, and TR. CAPTION defines a table caption, and can take one attribute -- ALIGN -- to define where the caption should be placed. Possible values are "top", "bottom" "left" and "right".

TR defines a Table Row -- a table is composed of any number of rows. Each row in turn contains TD (table data) or TH (table header) cells. The number of TD or TH elements defines the number of columns in the table, while the number of TR elements defines the number of rows. In general, TD elements are used for data, while TH elements are used for row or column headings.

TABLE Example: A Simple Table

Here is a simple table example, -- a table with 3 rows and 4 columns

<caption align="bottom">This is the Table Caption</caption>
<TR> <TH>Heading 1 <TH> Heading 2 <TH> Heading 3 <TH> Heading 4 </TR>
<TR> <TD> 0.32 </TD> <TD> 1.2 </TD> <TD> 3.2 </TD> <TD> alpha </TD> </TR>
<TR> <TD> 0.44 </TD> <TD> 0.3 </TD> <TD> 7.2 </TD> <TD> beta </TD> </TR>

This table is displayed as:

This is the Table Caption
Heading 1 Heading 2 Heading 3 Heading 4
0.32 1.2 3.2 alpha
0.44 0.3 7.2 beta

Things to Note

[Next] .................... Introduction to HTML

Page Last Updated: 5 April 1996