Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
While you should instead use the CSS border-spacing
property, the obsolete HTMLTableElement
interface's cellSpacing
property represents the spacing around the individual <th>
and <td>
elements representing a table's cells. Any two cells are separated by the sum of the cellSpacing
of each of the two cells.
Syntax
HTMLTableElement.cellSpacing = spacing; var spacing = HTMLTableElement.cellSpacing;
Value
A DOMString
which is either a number of pixels (such as "10"
) or a percentage value (like "10%"
).
Example
This example sets cell spacing for a given table to 10 pixels.
var t = document.getElementById('TableA'); t.cellSpacing = "10";
Specification
- W3C DOM 2 HTML Specification HTMLTableElement .cellSpacing.
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
cellSpacing | Chrome Full support Yes | Edge Full support 12 | Firefox Full support Yes | IE Full support Yes | Opera Full support Yes | Safari Full support Yes | WebView Android Full support Yes | Chrome Android ? | Firefox Android Full support Yes | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android ? |
Legend
- Full support
- Full support
- Compatibility unknown
- Compatibility unknown
- Deprecated. Not for use in new websites.
- Deprecated. Not for use in new websites.