cellPadding property (table)
Specifies or returns the amount of space between the border of a cell and its contents in a table.
Use the cellSpacing property if you want to set the space between cells.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: cellPadding |
Possible values:
Sets or retrieves the amount of space between the border of the cell and its contents.
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 cellPadding attribute:
|
||||
Table, with 10px cellpadding: <table border="3px" cellpadding="10px"> <tr> <td>Apple</td> <td>Pear</td> <td>Peach</td> </tr> </table> <br /><br /> Table, without cellpadding: <table border="3px" cellpadding="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 cellPadding property:
|
||||
<head> <script type="text/javascript"> function SetCellPadding () { var input = document.getElementById ("myInput"); var table = document.getElementById ("myTable"); table.cellPadding = input.value; } </script> </head> <body> <table id="myTable" border="3px" cellpadding="10px"> <tr> <td>Apple</td> <td>Pear</td> <td>Peach</td> </tr> </table> <input id="myInput" type="text" value="20" /> <button onclick="SetCellPadding ();">Set cellPadding!</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
HTML elements:
Related pages:
External links:
cellPadding (MSDN)
cellPadding (Mozilla Developer Center)
cellPadding (Safari Reference Library)
cellPadding (W3C)
cellPadding (Mozilla Developer Center)
cellPadding (Safari Reference Library)
cellPadding (W3C)
User Contributed Comments