自定义垂直表头和表格数据的空间

huangapple go评论53阅读模式
英文:

Customize space for vertical table header and table data

问题

我有一个下面有垂直标题的表格。我试图找到一种方法来移除表头和表格数据内部的额外空格。以下是我构建表格的方式。

<table>
  <tr>
    <th class="field">项目编号:</th>
    <td class="column">XXX 1234(位置)</td>
  </tr>
  <tr>
    <th class="field">数值:</th>
    <td class="column">100,000 - 150,000 CM</td>
  </tr>
  <tr>
    <th class="field">项目状态:</th>
    <td class="column">已通过</td>
  </tr>
</table>

表格图片-

自定义垂直表头和表格数据的空间

预览链接

我尝试重置表头和表格行的填充和边距,但我不认为那真的是解决方法。

英文:

I have a table below with vertical headers. I'm trying to find a way to remove the extra space inside the table header and table data. Below is how I constructed my table.

&lt;table&gt;
  &lt;tr&gt;
    &lt;th class=&quot;field&quot;&gt;Item id number:&lt;/th&gt;
    &lt;td class=&quot;column&quot;&gt;XXX 1234 (Location)&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th class=&quot;field&quot;&gt;Values:&lt;/th&gt;
    &lt;td class=&quot;column&quot;&gt;100,000 - 150,000 CM&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;th class=&quot;field&quot;&gt;Item status:&lt;/th&gt;
    &lt;td class=&quot;column&quot;&gt;Passed&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

Table image-

自定义垂直表头和表格数据的空间

Preview link

I tried resetting the padding and margin for the table header and table row but I don't think that's really the solution to it.

答案1

得分: 0

这种方法是将宽度和不换行结合起来:

.field {
    text-align: start;
    font-weight: 400;
    width: 1%;
    white-space: nowrap;
}

自定义垂直表头和表格数据的空间

祝编码愉快。

英文:

The approach is combine width and nowrap like that:

 .field {
    text-align: start;
    font-weight: 400;
    width: 1%;
   white-space: nowrap;
 }

自定义垂直表头和表格数据的空间

Happy coding.

huangapple
  • 本文由 发表于 2023年2月19日 07:19:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/75496997.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定