The Table Tag

ken's picture

Opening tag : <TABLE>
Closing tag: </TABLE>

Purpose:
The table tag is used to create a table - i.e. a spreadsheet like structure with a specified number of columns and rows. Tables are declared using the Table tag, and then columns and rows are later added using 'TD' and 'TR' tags respectively. Tables have often been used as an easy way of laying out your website, for positioning different parts of the page. However, we strongly advise against this, as it is better to deal with layout issues by using a stylesheet.

Attributes:
Align=alignment
- Sets the alignment of the table - could be LEFT, CENTER or RIGHT.

Background=url
- Specifies a url containing an image, which is then used as the background of the table.

Bgcolor=color
- Specifies a background color for the table.

Border=#
- Specifies the width of the border in pixels.

Bordercolor=color
- Specifies a color for the border - although this is only applied if the border attribute is non-zero.

Bordercolordark=color
- Specifies 1 color for a 3d, two-tone border, applied if the border attribute is non-zero.

Bordercolorlight=color
- Specifies the other color for a 3d, two-tone border, applied if the border attribute is non-zero.

Cellborder=#
- Specifies the width of the border for cells in pixels.

Cellpadding=#
- Specifies the number of pixels in between the cells and the content of the cells.

Cellspacing=#
- Specifies the number of pixels outside of the border for each cell.

Class=class
- Formats the table using the class specified.

Dir=direction.
- Useful for languages which should be read from right to left.

Event=Javascript
- Applies a javascript to run on certain events.

Gradangle=#
- A number between -90 and 90 specifies a gradient angle for the table.

Gradcolor=color
- Specifies a color for the gradient if specified.

Height=#
- Specifies the height of the table.

Hspace=#
- Specifies the number of pixels to the left and right of the table.

Id=name
- Allows an id to be applied to the table, so it can be referenced or manipulated from an external script.

Lang=language
- Specifies the language of the text within the table.

Nowrap
- Keeps data within the table if the width is exceeded, without wrapping.

Rules=value
- Used to specify how borders are applied throughout the table. Allowed values are;
ALL = Borders on all sides.
COLS = Displays borders on vertical column borders.
NONE = No internal borders
ROWS = Displays borders on horizontal row borders.

Style=style
- Specifies a style to be used, to overwriting any other styling applications.

Summary=string
- Provides a summary of the table contents for browsers that can't display tables.

Title=title
- Allows you to specify a title for the table.

Vspace=#
- Specifies the number of pixels space to be left above and below the table.

Width=#
- Specifies the width of the table in pixels.

Example:

<Table>
<TR>
<TD> Width="50%"</TD>
<TD> Width="25%"</TD>
<TD> Width="25%"</TD>
</TR>
<TR>
<TD> Width="50%"</TD>
<TD> Width="25%"</TD>
<TD> Width="25%"</TD>
</TR>
</Table>

Related Tags:

<Caption></Caption> - Caption Tag.
<Col></Col> - Col Tag.
<Colgroup> - Colgroup Tag.

Back to:
Alphabetical Guide
Guide By Type