Forum How do I...?

Space between nested tables

caudingo
A variable number of tables of variable length get generated dynamically. Right now, they are all put inside a main table to retain the main header, and it works just fine.
The spacing between the sub-tables is added as padding-top of the td containing each sub-table, like this (simplified):
<table class="main">
  <thead>...</thead>
  <tbody>
  <tr class="rowSubTable">
    <td>
       <table>...</table>
    </td>
  </tr>
<tr class="rowSubTable">
    <td>
       <table>...</table>
    </td>
  </tr>
</tbody>
</table>


tr.rowSubTable:not(:first-child) > td {
    padding-top: 40px;
}


The problem is that the padding is applied even when a sub-table starts on a new page, which is obviously not necessary.
Is there a way to add padding (or whatever space) only when not on top of a new page?
mikeday
Perhaps you could add padding at the bottom of the previous sub-table instead?
caudingo
It works perfectly, thanks. As simple as that :-)