CSS cellspacing equivalent


In HTML, there used to be a handy attribute on the table called “cellspacing”. The CSS equivalent of this is “border-spacing” property. I’m going to use inline CSS via the style tag for this example:

New CSS Version:

<table style="border-spacing: 0px;">
    <tr>
        <td>First Name</td>
        <td>Last Name</td>
    </tr>
</table>

Old HTML Version:

<table cellspacing="0">
    <tr>
        <td>First Name</td>
        <td>Last Name</td>
    </tr>
</tr>

Side note: If you’re looking for replacements for old cellpadding attributes you’ll want to look at the CSS “padding” property on the various elements.