HTML and CSS Reference
In-Depth Information
10.2.1.6. The cellspacing attribute
The
cellspacing
attribute controls the amount of space placed between
adjacent cells in a table and along the outer edges of cells along the
edges of a table.
Browsers normally put two pixels of space between cells and along the
outer edges of a table. If you include a
border
attribute in the
<table>
tag, the cell spacing between interior cells grows by two more pixels
(for a total of four) to make space for the chiseled edge on the interior
border. The outer edges of edge cells grow by the value of the
border
attribute.
By including the
cellspacing
attribute, you can widen or reduce the in-
terior cell borders. For instance, to make the thinnest possible interior
cell borders, include the
border
and
cellspacing=0
attributes in the
table's tag.
10.2.1.7. The cellpadding attribute
The
cellpadding
attribute controls the amount of space between the
edge of a cell and its contents, which by default is 1 pixel. You may
make all the cell contents in a table touch their respective cell borders
by including
cellpadding=0
in the table tag. You may also increase the
cellpadding
space by making its value greater than 1.
10.2.1.8.
Combining
the
border,
cellspacing,
and
cellpadding
attributes
The interactions between the
border, cellspacing
, and
cellpadding
at-
tributes of the
<table>
tag combine in ways that can be confusing.
Figure
10-2
summarizes how the attributes create interior and exterior borders
of various widths.