HTML <table> cellspacingAttribute

HTML table 标签参考手册HTML <table> Tag

Examples

Set the cellspacing of the table to 10 pixels:

<table border="1" cellspacing="10"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> </table>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the cellspacing attribute.


Definition and Usage

HTML5 does not support the <table> cellspacing attribute.

The cellspacing attribute specifies the space between cells, in pixels. If this attribute is not set, its default value iscellspacing="2"。

Note:Do not confuse this attribute with cellpaddingthe cellpadding attribute. The cellpadding attribute specifies the space between the cell edge and the cell content.


Syntax

<table cellspacing="pixels">

Attribute Values

Value Description
pixels Specifies the space between cells.


HTML table 标签参考手册HTML <table> Tag Other Extensions