| HTML Tag |
Attributes (options) |
Description |
| TABLE |
ALIGN="left|right|center"
|
This is the main tag for specifying a table, and requires an ending </TABLE> tag.
ALIGN specifies the placement of the table.
|
See the Table Examples page for additional table and table coding examples.
A simple 2 row by 2 column table.
|
Row 1, Column 1
|
Row 1, Column 2
|
|
Row 2, Column 1
|
Row 2, Column 2
|
|
CELLSPACING=n
|
Controls the line thickness separating individual cells in a table, where n represents the line thickness in pixels. If not specified, the default value is usually 2
|
|
The same table as above with CELLSPACING=7.
|
Row 1, Column 1
|
Row 1, Column 2
|
|
Row 2, Column 1
|
Row 2, Column 2
|
|
CELLPADDING=n
|
Controls the amount of space between the border of a cell and it's contents, where n represents the spacing in pixels.
|
|
The same table with CELLPADDING=10.
|
Row 1, Column 1
|
Row 1, Column 2
|
|
Row 2, Column 1
|
Row 2, Column 2
|
|
WIDTH=n
|
Specifies the width of your table, where n represents either the width in pixels, or as a percentage of the browser window width. If not specified, the width of the table will be 100%.
|
|
A 2 x 2 table with WIDTH=50 pixels wide.
|
Row 1, Column 1
|
Row 1, Column 2
|
|
Row 2, Column 1
|
Row 2, Column 2
|
The same table with WIDTH=90%.
|
Row 1, Column 1
|
Row 1, Column 2
|
|
Row 2, Column 1
|
Row 2, Column 2
|
|
BORDER=n
|
Allows you to specify the width of a border to place around your table, where n represents the width, in pixels, of the border. If not specified, no border will be displayed.
|
|
A 2 x 2 table with BORDER=10
|
Row 1, Column 1
|
Row 1, Column 2
|
|
Row 2, Column 1
|
Row 2, Column 2
|
|
BGCOLOR= "#xxxxxx|colorname"
|
Specifies the background color for your table. For more information about colors and colornames, see the Text and Background Colors page.
NOTE: Although Netscape v2.x does not support the BGCOLOR attribute for tables, Netscape v3.x does.
|
|
The same table as above with BGCOLOR="#ff0000" (red).
|
Row 1, Column 1
|
Row 1, Column 2
|
|
Row 2, Column 1
|
Row 2, Column 2
|
|
BORDERCOLOR= "#xxxxxx|colorname"
|
Specifies the color of the border of your table. |
|
The same table with BORDERCOLOR="blue" (#0000ff)
|
Row 1, Column 1
|
Row 1, Column 2
|
|
Row 2, Column 1
|
Row 2, Column 2
|
|
BORDERCOLORLIGHT= "#xxxxxx|colorname"
|
Specifies the color for the top and left borders of your table |
|
A 2 x 2 table with BORDERCOLORLIGHT= "aqua" ("#00ffff")
|
Row 1, Column 1
|
Row 1, Column 2
|
|
Row 2, Column 1
|
Row 2, Column 2
|
|
BORDERCOLORDARK= "#xxxxxx|colorname"
|
Specifies the color for the bottom and right borders of your table |
|
The same table as above with BORDERCOLORDARK= "#0000ff" (blue)
|
Row 1, Column 1
|
Row 1, Column 2
|
|
Row 2, Column 1
|
Row 2, Column 2
|
|
| TR |
ALIGN="left|right|center"
|
Defines a row in a table, and requires an ending </TR> tag.
ALIGN specifies the horizontal placement of the contents of the cell(s) within a row. If not specified, the default placement is left.
|
|
The same table as above with the top row specified as ALIGN="center", and the bottom row specified as ALIGN="right"
|
Row 1, Column 1
|
Row 1, Column 2
|
|
Row 2, Column 1
|
Row 2, Column 2
|
|
VALIGN= "top|middle|bottom"
|
Specifies the vertical placement of the contents of a cell(s) in a row. If not specified, the default placement is middle.
|
|
A 2 x 2 table with the top row specified as VALIGN="top", and the bottom row specified as VALIGN="bottom"
|
Row_1
|
Row 1, Column 2, VALIGN="top"
|
|
Row_2
|
Row 2, Column 2, VALIGN="bottom"
|
|
BGCOLOR= "#xxxxxx|colorname"
|
Allows you to specify the background color of all the cells in a single row. |
|
The same table as above with the BGCOLOR of the bottom row specified as "#ffffff" (white)
|
Row 1, column 1
|
Row 1, Column 2
|
|
Row 2, column 1
|
Row 2, Column 2
|
|
| TD |
ALIGN="left|right|center"
|
Defines a table cell, determines the number of columns in your table, and requires and ending </TD> tag. A cell can contain any HTML tags that would normally be placed in the BODY of your page.
ALIGN works the same for TD as for TR (table row), but only for a specific cell.
|
|
A 2 x 2 table with the top left cell specified as ALIGN="center", and the bottom right cell specified as ALIGN="right"
|
Row 1, column 1
|
Row 1, Column 2
|
|
Row 2, column 1
|
Row 2, Column 2
|
|
VALIGN= "top|middle|bottom"
|
Specifies the vertical placement of the contents of a cell(s) in a row. If not specified, the default placement is middle.
|
|
A 2 x 2 table with the top left cell specified as VALIGN="top", and the bottom left cell specified as VALIGN="bottom"
|
Row_1
|
Row 1, Column 2
|
|
Row_2
|
Row 2, Column 2
|
|
BGCOLOR= "#xxxxxx|colorname"
|
Allows you to specify the background color of a single cell in a table. |
|
The same table as above with the BGCOLOR of the bottom left cell specified as "#ffffff" (white), and the BGCOLOR of the upper right cell specified as "green" (#00ff00)
|
Row_1
|
Row 1, Column 2
|
|
Row_2
|
Row 2, Column 2
|
|
COLSPAN=n
|
Specifies how many columns of your table a cell is to span, where n represents the number of columns the cell is to span
|
|
An example of COLSPAN=2
|
This cell spans the bottom two cells.
|
|
Row 2, Column 1
|
Row 2, Column 2
|
|
ROWSPAN=n
|
Specifies how many rows of your table a cell is to span, where n represents the number of rows the cell is to span.
|
|
An example of ROWSPAN=2
|
This cell spans the right two cells.
|
Column 2, Row 1
|
|
Column 2, Row 2
|
|
| TH |
Same as for TD.
|
Defines a table header, and requires an ending </TH> tag. Table headers support the same attributes as TD (table data) does, the difference is that table headers are displayed in bold font and aligned center by default.
|
|
A 2 x 3 table with headers
| Header 1 |
Header 2 |
|
Row 1, Column 1
|
Row 1, Column 2
|
|
Row 2, Column 1
|
Row 2, Column 2
|
|