English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

Complete List of HTML Tags

HTML table cellpadding attribute

The table cellpadding attribute specifies the spacing between the cell wall and cell content (in pixels). HTML5 The <table> cellpadding attribute is not supported, please use CSS instead

 HTML <table> tag

Online Example

Set the spacing between the cell wall and cell content8Pixels:

<table cellpadding="8" border="1">
  <tr>
    <th>Name</th>
    <th>Credits</th>/th>
  </tr>
  <tr>
    <td>Zhang San</td>/td>
    <td>90</tr>/td>
  </tr>
  <tr>
    <td>Li Si</td>/td>
    <td>87</td>
  </tr>
</table>
Test it out ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the cellpadding attribute.

Definition and Usage

HTML5 The <table> cellpadding attribute is not supported, please use CSS instead.

The cellpadding attribute specifies the space between the cell border and the cell content, in pixels.

Note:Do not confuse this attribute with cellspacing attributes may be confused, the cellspacing attribute specifies the space between cells.

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

Syntax

<table cellpadding="pixels">

Attribute Value

ValueDescription
pixelsSpecifies the space between the cell border and the cell content.
 HTML <table> tag