Name
Table
Description
Defines a table. It is possible to nest tables i.e. create another
table within a cell.
Tables can be used to show sets of data or to layout sections of the page -
as used on this site.
Attributes
ALIGN
Aligns the table - set to either 'left', 'center' or 'right'.
BACKGROUND
Sets the background picture for the table. To show to an image on the
same site use the local path e.g. src="button.gif" or src="folder/photo1.jpg".
You can also use dots to link to an image in the parent folder e.g. src="..\diagram.png".
To show a picture from another site, use the full URL e.g. src="http://www.martin2k.co.uk/tgflogo.gif".
BGCOLOR
Specifies the background colour of the table. If the BACKGROUND
attribute is also used, the image will cover the background colour unless the
background image contains transparent areas.
BORDER
Sets the border width in pixels. If set to 0, the borders will be
hidden.
BORDERCOLOR
Specifies the border colour. Style sheets
should be used instead.
BORDERCOLORDARK
Specifies the border colour on the left and bottom. Style
sheets should be used instead.
BORDERCOLORLIGHT
Specifies the border colour on the right and top. Style
sheets should be used instead.
CELLPADDING
Specifies the number of pixels between the cell walls and the contents
within.
CELLSPACING
Specifies the number of pixels between each cell.
FRAME
Specifies how the outer border is displayed. The following values are
valid:
| Value |
| above |
| below |
| border |
| box |
| hsides |
| lhs |
| rhs |
| void |
| vsides |
The border attribute must also be set.
HEIGHT
Specifies the height of the table in pixels or per cent.
RULES
Specifies how the internal borders are displayed. The following values
are valid:
| Value |
| all |
| cols |
| groups |
| none |
| rows |
The border attribute must also be set.
WIDTH
Specifies the width of the table in pixels or per cent.
Defining Colours
Colours can be defined in this format: #RRGGBB where the values are in
hexadecimal format. E.g. #FF0000 is red. Colours can also be defined
with words e.g. red.
Related Tags
The TR tag defines a row and the TD
tag defines a cell.
Other tags related to tables include TBODY, TFOOT,
TH and THEAD.
Example
Code
<table border="2" cellpadding="1" cellspacing="2"
width="100%" bgcolor="#000000" bordercolor="#FF0000"
bordercolordark="#800000" bordercolorlight="#FF8080">
<tr>
<td>Top left cell</td>
<td>Top middle cell</td>
<td>Top right cell</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
Generates
| Top left cell |
Top middle cell |
Top right cell |
| |
|
|
| |
|
|
© Martin Allen 1999 - 2006. Last updated Thursday 09 November 2006 10:06:45 PM -0000.
|