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

HTML Reference Manual

HTML Tag Directory

HTML table cellspacing attribute

The HTML 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>Credits</th>
  </tr>
  <tr>
    <td>Zhang San</td>
    <td>90</td>
  </tr>
  <tr>
    <td>Li Si</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 cells in pixels. If this attribute is not set, its default value is cellspacing="2".

Note:Do not confuse this attribute with cellpadding Attributes may be confused, 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 cells.
 HTML <table> Tag