TABLE Attribute Extensions


With some browsers you can assign a number to BORDER to specify the width, in pixels, of the outside table border. You can also assign numbers to the CELLPADDING and CELLSPACING attributes. CELLPADDING defines the space, in pixels, between the cell contents and the cell borders, while CELLSPACING defines the space between the cells (the width of the borders).

Finally, the WIDTH attribute sets the width of the entire table. This can be expressed as an absolute number (in pixels) or as a percentage width of the entire display.

Simple Table Examples

Here are some simple tables, showing how the WIDTH, CELLSPACING, CELLPADDING and BORDER attributes work:

<table border>
<TR><TH>Head 1</TH><TH>Head 2</TH></TR>
<TR><TD>abc</TD><TD>xyz</TD></TR>
</table>

Head 1 Head 2
abc xyz
<table border width=80%>
<TR><TH>Head 1</TH><TH>Head 2</TH></TR>
<TR><TD>abc</TD><TD>xyz</TD></TR>
</table>
Head 1 Head 2
abc xyz

<table border width=80>
<TR><TH>Head 1</TH><TH>Head 2</TH></TR>
<TR><TD>abc</TD><TD>xyz</TD></TR>
</table>

Head 1 Head 2
abc xyz
<table border=8>
<TR><TH>Head 1</TH><TH>Head 2</TH></TR>
<TR><TD>abc</TD><TD>xyz</TD></TR>
</table>

Head 1 Head 2
abc xyz
<table border cellpadding=8>
<TR><TH>Head 1</TH><TH>Head 2</TH></TR>
<TR><TD>abc</TD><TD>xyz</TD></TR>
</table>

Head 1 Head 2
abc xyz
<table border cellspacing=8>
<TR><TH>Head 1</TH><TH>Head 2</TH></TR>
<TR><TD>abc</TD><TD>xyz</TD></TR>
</table>

Head 1 Head 2
abc xyz