Latest web development tutorials

HTML table cellpadding attribute

HTML table tag Reference Manual HTML <table> tag

Examples

The table cell spacing between the edge of the cell content is set 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>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support cellpadding attribute.


Definition and Usage

HTML5 does not support the <table> cellpadding attribute. Use CSS instead.

cellpadding attribute specifies the edge between the unit and the cell content of the space, in pixels.

Note: Do not use this attribute cellspacing attribute confused, cellspacing attribute specifies that the space between cells.

Tip: From a practical point of view, it is best not specified cellpadding, but the use of CSS to add padding (padding) .


grammar

<table cellpadding="pixels">

Property Value

描述
pixels 规定单元边沿与单元内容之间的空间。


HTML table tag Reference Manual HTML <table> tag