asp.net.ph

Skip Navigation LinksHome > Abakada: Back to Basics > Language References > HTML Element Attributes > CELLSPACING Attribute

cellspacing Attribute


Sets or retrieves the amount of space between cells in a table.

Applies To: TABLE

Syntax

Inline <TABLE CELLSPACING = iSpacing [ % ] ... >
Script table.cellSpacing = iSpacing ]

Possible Values

iSpacing Integer specifying the amount of space between the border and the content, in pixels.
iSpacing% Integer followed by a percent sign ( % ). This indicates the amount of space between the border and the content as a percentage of the available space.

The property is read/write with no default value.

Remarks

This attribute specifies how much space the browser should leave between the left side of the table and the left-hand side of the leftmost column, the top of the table and the top side of the topmost row, and so on for the right and bottom of the table.

In effect, the attribute also specifies the amount of space to leave between cells.

Example

The following example demonstrates use of both the CSS CELLSPACING style attribute and the cellSpacing property.

<table id="theTable" border cellSpacing=10>
<tr>
   <th>Header 1</td>
   <th>Header 2</th>
   <th>Header 3</th></tr>
<tr>
   <td>Cell 1</td>
   <td>Cell 2</td>
   <td>Cell 3</td></tr>
</table>
<br>
<button onclick="theTable.cellSpacing=15">More</button>
<button onclick="theTable.cellSpacing=10">Reset</button>
<button onclick="theTable.cellSpacing=5">Less</button>

 Show me 

Applies To

TABLE

See Also

cellPadding


Need a break ?
Suggested Reading

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph.

If you have any question, comment or suggestion,
please send us a note