如何删除html表格单元格中的所有左侧和右侧填充?

问题描述 投票:0回答:2

我正在创建一个时间轴,在时间轴中代表每年的一列;我希望这些年份列尽可能“瘦”(不宽)。现在,它们看起来像这样:

enter image description here

如何删除年份之间单元格中的所有左侧和右侧填充?

我当前的代码是:

<table class="table table-sm table-bordered">
  <thead class="thead-dark">
    <tr>
      <th scope="col">NAME</th>
      <th scope="col">RELATIONSHIP</th>
      <th scope="col">1794</th>
      <th scope="col">1795</th>
      <th scope="col">1796</th>

注意:我也希望行不要换行。行代码当前为:

<tr>
      <th scope="row">John Marshall Clemens</th>
      <td>Father</td>
      <td>~</td>
      <td>~</td>
      <td>~</td>
html bootstrap-table
2个回答
0
投票

您可以根据需要使用称为csswidth属性来调整单元格的宽度。

例如。

html文件

  <th scope="col" style="width: 0px;">1794</th>

您需要在宽度上输入适当的值,而不是0px


0
投票

您可以这样使用它

<table cellpadding = "0">
  <tr>
    <th> Month </th>
    <th> Savings </th>
  </tr>
  <tr>
    <td> January </td>
    <td> $100 </td>
  </tr>
</table>
© www.soinside.com 2019 - 2024. All rights reserved.