Idocs Guide to HTML

Table Borders: The Basics

The most basic issue concerning table borders is if there should be any borders at all. That issue is settled with the BORDER attribute to the <TABLE ...> tag.

By default, tables do not have borders. For example, this code, which does not have any attributes in the <TABLE ...> tag, produces a table with no borders:

<TABLE>
<TR> <TD>watermelon</TD> <TD>grapes</TD>  </TR>
<TR> <TD>peaches</TD>    <TD>bananas</TD> </TR>
</TABLE>

which gives us

watermelon grapes
peaches bananas

To give the table borders we add the BORDER attribute to the <TABLE ...> tag:

<TABLE BORDER>

which gives us this table

watermelon grapes
peaches bananas

BORDER sets the width of the outer border. So, for example, this code creates a table with an outside border width of 10:

<TABLE BORDER=10>

which gives us this table

watermelon grapes
peaches bananas

Note that BORDER sets the width of the outside border. The width of the inside borders are set with CELLSPACING.

Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.