cellspacing attribute | cellSpacing property
Sets or retrieves the amount of space between cells in a table.
![]() |
Syntax
| HTML | <element cellspacing="p" ... > |
|---|---|
| JavaScript | |
Property values
Type: Variant
spacing
-
Integer that specifies the amount of space between cells, in pixels.
percentage
-
Integer, followed by a %. The value is a percentage of the available amount of space between the border and the content.
Standards information
- Document Object Model (DOM) Level 1 Specification, Section 2.5.5
- HTML 4.01 Specification, Section 11.3.3
Examples
This example uses the cellspacing attribute and the cellSpacing property to change the spacing between two cells.
Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/cellSpacing.htm
<table id=oTable border cellspacing="10">
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
</table>
:
<button onclick="oTable.cellSpacing=20">Larger spacing</button>
<button onclick="oTable.cellSpacing=5">Smaller spacing</button>
See also
Send comments about this topic to Microsoft
Build date: 11/28/2012
