ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
Last Update: 5 January 1998

4.11.2 TABLE Attribute Extensions

HTML now supports several additional TABLE element attributes, most of which are now widely supported. For example, The value assigned to a BORDER attribute will set 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 (that is, padding within each cell of the table), while CELLSPACING defines the space betweenthe cells (the width of the cell-cell border).

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 available space for the table -- 100% being as wide as possible.

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> Head 2 </TR>
<TR> <TD> 4.11   <TD> 4.23   </TR>
</table>

Head 1 Head 2
4.11 4.23
<table border=8>
<TR> <TH> Head 1 <TH> Head 2 </TR>
<TR> <TD> 4.11   <TD> 4.23   </TR>
</table>

Head 1 Head 2
4.11 4.23
<table border cellpadding=8>
<TR> <TH> Head 1 <TH> Head 2 </TR>
<TR> <TD> 4.11   <TD> 4.23   </TR>
</table>

Head 1 Head 2
4.11 4.23
<table border cellspacing=8>
<TR> <TH> Head 1 <TH> Head 2 </TR>
<TR> <TD> 4.11   <TD> 4.23   </TR>
</table>

Head 1 Head 2
4.11 4.23
<table border width=80%>
<TR> <TH> Head 1 <TH> Head 2 </TR>
<TR> <TD> 4.11   <TD> 4.23   </TR>
</table>
Head 1 Head 2
4.11 4.23

<table border width=80>
<TR> <TH> Head 1 <TH> Head 2 </TR>
<TR> <TD> 4.11   <TD> 4.23   </TR>
</table>
Head 1 Head 2
4.11 4.23


ToC ~ Up ~ Prev ~ Next ~ Index Introduction to HTML
© 1994-1998 by Ian Graham
Last Update: 5 January 1998