HTML DOM cellPadding Property
Complete Table Object Reference
Definition and Usage
The cellPadding property sets or returns the amount of space (in pixels) between the cell
border and the cell content.
Syntax
tableObject.cellPadding=pixels
|
Example
The following example changes the cell padding of a table:
<html>
<head>
<script type="text/javascript">
function padding()
{
document.getElementById('myTable').cellPadding="15"
}
</script>
</head>
<body>
<table id="myTable" border="1">
<tr>
<td>100</td>
<td>200</td>
</tr>
<tr>
<td>300</td>
<td>400</td>
</tr>
</table>
<br />
<input type="button" onclick="padding()" value="Change Cellpadding">
</body>
</html>
|
Try-It-Yourself Demos
Change the cellPadding and cellSpacing of a table
Complete Table Object Reference
|
|
Get Your Diploma!
W3Schools' Online Certification Program is the perfect solution for busy
professionals who need to balance work, family, and career building.
The HTML Certificate is for developers who want to document their knowledge of HTML, XHTML, and CSS.
The JavaScript Certificate is for developers who want to document their knowledge of JavaScript and the HTML DOM.
The XML Certificate is for developers who want to document their knowledge of XML, XML DOM and XSLT.
The ASP Certificate is for developers who want to document their knowledge of ASP, SQL, and ADO.
The PHP Certificate is for developers who want to document their knowledge of PHP and SQL (MySQL).
|
|