0

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)

Current result - white space:

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">&nbsp;</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">&nbsp;</td>
    <td colspan="4" class="totalleft">Sales Tax</td>
    <td align="right" colspan="2" class="totalright">${record.taxtotal}</td>
  </tr>
  <tr>
    <td colspan="3">&nbsp;</td>
    <td colspan="4" class="totalleft">Freight</td>
    <td align="right" colspan="2" class="totalright">${record.shippingcost}</td>
  </tr>
  <tr>
    <td colspan="3">&nbsp;</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!

sweetarts
  • 11
  • 2
  • 1
    I've converted your code into a stack snippet, that is intended to show your code "working," insofar as it should reproduce the problem you describe. Could you edit your code so that it does reproduce your problem, adding the relevant borders and additional CSS? – David Thomas Apr 20 '22 at 23:04
  • @DavidThomas Thank you for the guidance! I edited it – sweetarts Apr 20 '22 at 23:50

0 Answers0