如何将文本对齐到 table 个单元格下方

How to align text to below table cells

我在下面整理了一个粗略的模板,说明我正在尝试对下面的每个内容进行尝试。如何让右边的数字和下面的小方块对齐?

我想我需要通过删除所有边框等来创建 'invisible cells' 并使用 css。这是正确的方法还是有更简单的方法?

https://jsfiddle.net/Elbusta/8720rhdq/18/

/* styles */

table {
  border: 1px solid black;
}

thead tr {
  text-align: left;
  vertical-align: top;
  border: 1px solid black;
}

td {
  text-align: left;
  vertical-align: top;
  border: 1px solid black;
}

th {
  text-align: left;
  vertical-align: top;
  border: 1px solid black;
}

span {
  float: right;
}

.time-cell {
  width: 26px;
}
<table style="undefined;table-layout: fixed; width: 577px">
  <colgroup>
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
  </colgroup>
  <thead>
    <tr>
      <th colspan="8"><br>Month January 2022<br>Day<br>time 11 12 13 14 15 16 17</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>13:00</td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td>15:00</td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td>16:00</td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td>13:00</td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td>15:00</td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td>16:00</td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
  </tbody>
</table>

只需将它们排成一排,每个都放在自己的 <th> 中。如果您不希望它们可见,您可以随时使用 CSS 删除每个边框。

/* styles */

table {
  border: 1px solid black;
}

thead tr {
  text-align: left;
  vertical-align: top;
  border: 1px solid black;
}

td {
  text-align: left;
  vertical-align: top;
  border: 1px solid black;
}

th {
  text-align: left;
  vertical-align: top;
  border: 1px solid black;
}

span {
  float: right;
}

.time-cell {
  width: 26px;
}
<table style="undefined;table-layout: fixed; width: 577px">
  <colgroup>
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
    <col class="time-cell">
  </colgroup>
  <thead>
    <tr>
      <th colspan="8"><br>Month January 2022<br>Day</th>
    </tr>
    <tr>
      <th>time</th>
      <th>11</th>
      <th>12</th>
      <th>13</th>
      <th>14</th>
      <th>15</th>
      <th>16</th>
      <th>17</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>13:00</td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td>15:00</td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td>16:00</td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td>13:00</td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td>15:00</td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td>16:00</td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
    </tr>
  </tbody>
</table>

我为此创建了一个快速而肮脏的解决方案。我在您的号码周围添加并设计了一些强大的标签。

strong{
  padding-left:0.84rem;
}
<thead>
  <tr>
  <th colspan="7">Title row one<br>Sub Title - some text <br>Sub title<br>Sub Title<br></th>
  <th colspan="8"><br>Month   January           2022<br>Day<br> <div style="display:flex; justify-content: end;"><strong style="margin-right:3rem;">Time:</strong><strong>11 </strong><strong>12</strong><strong> 13</strong><strong> 14 </strong><strong>15</strong><strong> 16</strong><strong> 17</strong> </div>
    </th>
  </tr>
</thead>