Adding to vectran’s answer: You also have to set cellspacing
attribute on the table element for cross-browser compatibility.
<table cellspacing="0">
EDIT (for the sake of completeness I’m expanding this 5 years later:):
Internet Explorer 6 and Internet Explorer 7 required you to set cellspacing directly as a table attribute, otherwise the spacing wouldn’t vanish.
Internet Explorer 8 and later versions and all other versions of popular browsers – Chrome, Firefox, Opera 4+ – support the CSS property border-spacing.
So in order to make a cross-browser table cell spacing reset (supporting IE6 as a dinosaur browser), you can follow the below code sample:
table{
border: 1px solid black;
}
table td {
border: 1px solid black; /* Style just to show the table cell boundaries */
}
table.no-spacing {
border-spacing:0; /* Removes the cell spacing via CSS */
border-collapse: collapse; /* Optional - if you don't want to have double border where cells touch */
}
<p>Default table:</p>
<table>
<tr>
<td>First cell</td>
<td>Second cell</td>
</tr>
</table>
<p>Removed spacing:</p>
<table class="no-spacing" cellspacing="0"> <!-- cellspacing 0 to support IE6 and IE7 -->
<tr>
<td>First cell</td>
<td>Second cell</td>
</tr>
</table>