English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag大全

HTML table cellspacing attribute

The table cellspacing attribute specifies the spacing between cells (in pixels).

 HTML <table> tag

Online Example

Set the spacing between table cells to 8 Pixel:

<table cellspacing="8" border="1">
  <tr>
    <th>Name</th>/th>
    <th>Credits</th>/th>
  </tr>
  <tr>
    <td>Zhang San</td>/td>
    <td>90</td>/td>
  </tr>
  <tr>
    <td>Li Si</td>/td>
    <td>87</td>
  </tr>
</table>
Test it out ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the cellspacing attribute.

Definition and Usage

HTML5 The <table> cellspacing attribute is not supported.

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

Note:Do not confuse this attribute with cellpadding Attribute confusion, the cellpadding attribute specifies the space between the cell border and the cell content.

Syntax

<table cellspacing="pixels">

Attribute value

ValueDescription
pixelsSpecify the space between units.
 HTML <table> tag