Cell spacing is an attribute in HTML which is used to define the exact amount of spacing between pixels within cells. Whereas, Cell Padding is used to define the spacing between the cell wall and the cell content.

BY Best Interview Question ON 15 Jul 2020

Example

<p>Table without cell spacing:</p>
<table>
  <tr>
    <th>Months</th>
    <th>Saving</th>
  </tr>
  <tr>
    <td>February</td>
    <td>$100</td>
  </tr>
</table>

<table cellspacing="10">
  <tr>
    <th>Months</th>
    <th>Saving</th>
  </tr>
  <tr>
    <td>February</td>
    <td>$100</td>
  </tr>
</table>

<h4 class="mt-10 mb-10">Example of Cell Padding</h4>

<p>Table without cellpadding attribute :</p>
<table>
  <tr>
    <th>Months</th>
    <th>Saving</th>
  </tr>
  <tr>
    <td>February</td>
    <td>$100</td>
  </tr>
</table>

<p>Table with cellpadding attribute:</p>
<table cell padding="10">
  <tr>
    <th>Months</th>
    <th>Saving</th>
  </tr>
  <tr>
    <td>February</td>
    <td>$100</td>
  </tr>
</table>