cellSpacing property (table)
Sets or retrieves the amount of space between the border of the cells in a table.
Use the cellPadding property if you want to set the space between the border and contents of the cell.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: cellSpacing |
Possible values:
Sets or retrieves the amount of space between cells.
One of the following values:
Integer with or without a px (pixel) designator. | |||||||
Integer higher than or equal to 0 , with a % designator. |
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the cellSpacing attribute:
|
||||
Table, with 10px cellspacing: <table border="3px" cellspacing="10px"> <tr> <td>Apple</td> <td>Pear</td> <td>Peach</td> </tr> </table> <br /><br /> Table, without cellspacing: <table border="3px" cellspacing="0px"> <tr> <td>Apple</td> <td>Pear</td> <td>Peach</td> </tr> </table> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates the use of the cellSpacing property:
|
||||
<head> <script type="text/javascript"> function SetCellSpacing () { var input = document.getElementById ("myInput"); var table = document.getElementById ("myTable"); table.cellSpacing = input.value; } </script> </head> <body> <table id="myTable" border="3px" cellspacing="10px"> <tr> <td>Apple</td> <td>Pear</td> <td>Peach</td> </tr> </table> <input id="myInput" type="text" value="20" /> <button onclick="SetCellSpacing ();">Set cellSpacing!</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
HTML elements:
Related pages:
External links:
cellSpacing (MSDN)
cellSpacing (Mozilla Developer Center)
cellSpacing (Safari Reference Library)
cellSpacing (W3C)
cellSpacing (Mozilla Developer Center)
cellSpacing (Safari Reference Library)
cellSpacing (W3C)
User Contributed Comments