College of Engineering Logo Web Server Logs Student Server Logs Orange bar Main Page General Information Special Events Programs Research Student Information Computer Facility Outreach Xtreme Engineering Jobs Available

Table Tags

The current HTML standard allows the creation of tables. Most of the tags used to create tables have several attributes, and the attributes are listed with the description of the tags themselves.

Name Purpose Attributes Contents
CAPTION Create a table's caption ALIGN text
TABLE Create a table (tag must be closed) (see below) CAPTION TR
TD Table data (see below) (see below)
TH Table headers (see below) (see below)
TR Table rows ALIGN VALIGN TD TH

Example:

Description Count Price
Brown Widgets 3 $15.00
Red Widgets 5 $1.00
Total $50.00
<table border=1>
<tr><th>Description</th> <th>Count</th> <th> Price</th></tr>
<tr><td>Brown Widgets</td> <td>3</td>
<td align="right">$15.00</td></tr>
<tr><td>Red Widgets</td> <td>5</td>
<td align="right">$1.00</td></tr>
<tr><td>Total</td>
<td colspan=2 align="right">$50.00</td>
</tr>
</table>

Table Captions

The CAPTION tag is used within the TABLE tag to add a caption to the table. Its only attribute, ALIGN determines the location of the caption, which can be either TOP or BOTTOM.

The Table Tag

The TABLE tag creates the table. The ALIGN attribute can be either LEFT, CENTER or RIGHT, which determines the alignment of the table. The value of BORDER attribute controls the pixel width of the table cell borders. CELLPADDING and CELLSPACING control the spacing in pixels within and between cells, respectively. Finally, the WIDTH attribute determines the width of the table, similar in use to the corresponding attribute in the HR tag.

Attribute Purpose
ALIGN Table alignment
BORDER Pixel width of table borders
CELLPADDING Spacing within cells
Attribute Purpose
CELLSPACING Spacing between cells
WIDTH Table width

Table cells

Both the TD and TH tags create table cells. They both must be contained within the TR tag. While the TD tag is used to create cells containing table data, the TH tag is used to create header cells for the table, which are typically displayed in boldface. Both of these tags use the same set of attributes, which are explained below.
Attribute Purpose
ALIGN Cell's horizontal alignment
COLSPAN Number of columns cell occupies
HEIGHT Cell's height in pixels
NOWRAP Suppress word wrapping in cell
Attribute Purpose
ROWSPAN Number oable cells. By specifying these attributes in the TR tag declares a default value for all cells contained within the row.

Author: Ben Yoshino (ben@wiliki.eng.hawaii.edu)

Comments, Questions? | E-mail: webmaster@wiliki.eng.hawaii.edu


Last updated on Monday, February 05, 2001
Copyright © 2001 University of Hawai`i, College of Engineering, Computer Facility
All rights reserved.