I have a table where there should be a border only on certain sides of certain elements - i.e. everywhere except the bottom and left side of the td:first-child
Required Table - td:first-child no borders:
The problem: Small white spaces where borders don't come together between rows and columns (at corners)
This is the code.
table.total td {
padding-top: 5px;
padding-bottom: 5px;
line-height: 125%;
}
table.total td.totalleft {
padding-left: 15px;
border-left: 1px solid black;
border-bottom: 1px solid black;
border-right: 1px solid black;
}
table.total td.totalright {
border-right: 1px solid black;
border-bottom: 1px solid black;
}
<table class="total" style="width: 100%;">
<tr>
<td colspan="3"> </td>
<td colspan="4" class="totalleft">${record.subtotal@label}</td>
<td align="right" colspan="2" class="totalright">${record.subtotal}</td>
</tr>
<tr>
<td colspan="3"> </td>
<td colspan="4" class="totalleft">Sales Tax</td>
<td align="right" colspan="2" class="totalright">${record.taxtotal}</td>
</tr>
<tr>
<td colspan="3"> </td>
<td colspan="4" class="totalleft">Freight</td>
<td align="right" colspan="2" class="totalright">${record.shippingcost}</td>
</tr>
<tr>
<td colspan="3"> </td>
<td colspan="4" class="totalleft">Total Invoice Amount</td>
<td align="right" colspan="2" class="totalright">${record.subtotal+record.taxtotal+record.shippingcost}</td>
</tr>
</table>
Things I've tried
- Adding padding: 0; margin 0; under *, table, etc in CSS
- Adding border-collapse: collapse, border-spacing: 0;
- As a workaround, I've even tried "moving up" into the to remove the white corner using position: relative; top: -1px. But that just creates a white gap between the bottom row/cell and the border-bottom of the entire table
Thanks for any help!