You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何修改表格页脚Weight Percentage列,将其设为空白区域?

解决方法

要把页脚中Weight Percentage列下的三行内容设为空白,只需将该区域的单元格合并成一个跨3行、2列的空白单元格,替换掉原来的三行对应内容即可。

修改后的完整代码如下:

CSS

.table th, td {
  border: 1px solid black;
}

HTML

<table class="table">
  <thead>
    <tr>
      <td>Discipline</td>
      <th colspan="3">Weight Type 1</th>
      <th colspan="2" rowspan="2">Weight Percentage (%)</th>
      <th colspan="3">Weight Type 2</th>
    </tr>
    <tr>
      <th></th>
      <th>Weight 1</th>
      <th>Weight 2</th>
      <th>Weight 4</th>
      <th>Weight 1</th>
      <th>Weight 2</th>
      <th>Weight 4</th>
    </tr>
  </thead>
  <tbody>
    <tr style="background-color: white;">
      <th>Discipline 1</th>
      <td>10</td>
      <td>20</td>
      <td>30</td>
      <td colspan="2">100</td>
      <td>2</td>
      <td>1</td>
      <td>3</td>
    </tr>
    <tr style="background-color: white;">
      <th>Discipline 2</th>
      <td>20</td>
      <td>40</td>
      <td>60</td>
      <td colspan="2">100</td>
      <td>4</td>
      <td>2</td>
      <td>6</td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <td rowspan="3">
        <b>Summation</b>
      </td>
      <td rowspan="3">30</td>
      <td rowspan="3">60</td>
      <td rowspan="3">90</td>
      <!-- 合并为跨3行2列的空白单元格 -->
      <td colspan="2" rowspan="3"></td>
      <td rowspan="3">6</td>
      <td rowspan="3">3</td>
      <td rowspan="3">9</td>
    </tr>
  </tfoot>
</table>

说明

  • 原页脚中对应Weight Percentage的三行<td>内容被替换成一个colspan="2" rowspan="3"的空白单元格,占据了原本的2列3行区域,实现空白效果。
  • 同时移除了原tfoot中多余的两行<tr>,因为合并单元格后无需再单独编写这两行内容。

内容的提问来源于stack exchange,提问作者user8512043

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 22:35:18