Controlling Spacing Between Table Cells
Check this fiddle. You are going to need to take a look at using border-collapse and border-spacing. There are some quirks for IE (as usual). This is based on an answer to this question.
table.test td {
background-color: lime;
margin: 12px 12px 12px 12px;
padding: 12px 12px 12px 12px;
}
table.test {
border-collapse: separate;
border-spacing: 10px;
*border-collapse: expression('separate', cellSpacing='10px');
}
<table class="test">
<tr>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
</tr>
<tr>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
</tr>
<tr>
<td>Cell</td>
<td>Cell</td>
<td>Cell</td>
</tr>
</table>
Use the border-spacing
property on the table
element to set the spacing between cells.
Make sure border-collapse
is set to separate
(or there will be a single border between each cell instead of a separate border around each one that can have spacing between them).
table.test td {
background-color: lime;
padding: 12px;
border:2px solid #fff;border-collapse:separate;
}