You are here: Reference > HTML > attributes > cellSpacing (table)

cellSpacing attribute (table)

Browser support:
Sets the amount of space between the border of the cells in a table.
Use the cellPadding attribute if you want to set the space between the border and contents of the cell.
JavaScript page for this attribute: cellSpacing. You can find other example(s) there.

Possible values:

Sets the amount of space between cells.
One of the following values:
pixel offset
Integer with or without a px (pixel) designator.
percentage
Integer higher than or equal to 0 , with a % designator.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the cellSpacing attribute:
Table, with 10px cellspacing:
<table border="3px" cellspacing="10px">
    <tr>
        <td>Apple</td>
        <td>Pear</td>
        <td>Peach</td>
    </tr>
</table>

<br /><br />

Table, without cellspacing:
<table border="3px" cellspacing="0px">
    <tr>
        <td>Apple</td>
        <td>Pear</td>
        <td>Peach</td>
    </tr>
</table>
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments
Frank Conijn
cellSpacing wrongfully labeled obsolete in HTML5
As of HTML5, cellSpacing is labeled obsolete by the W3C Validator. But its CSS antagonist, border-spacing, is not supported by IE until IE8!

Post Content

Post Content