HTML <table> cellpaddingAttribute
Example
Set the spacing between table cell edges and cell content to 10 pixels:
<table border="1"
cellpadding="10">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the cellpadding attribute.
Definition and Usage
HTML5 does not support the <table> cellpadding attribute. Use CSS instead.
The cellpadding attribute specifies the space, in pixels, between the cell edges and the cell content.
Note:Do not confuse this attribute with thecellspacingcellspacing attribute; the cellspacing attribute specifies the space between cells.
Tip:From a practical standpoint, it is best not to specify cellpadding, but instead use CSS to addpadding (inner margin)。
Syntax
<table cellpadding="pixels">
Attribute Values
| Value | Description |
|---|---|
| pixels | Specifies the space between the cell edges and the cell content. |
HTML <table> Tag Other Extensions