【问题标题】:How to create a table with two columns, the first one's width is Auto and the second one is 100%如何创建一个有两列的表格,第一列的宽度是 Auto,第二列是 100%
【发布时间】:2017-11-21 06:53:44
【问题描述】:

在表格中:

如何设置列的宽度以实现以下功能:

两列,第一列的宽度适合内容的最大宽度。第二个的宽度是表格的其余宽度。

【问题讨论】:

  • 如果第一个是内容的最大宽度,第二个怎么还有宽度?
  • 据我了解,我认为您会想研究 colspan?
  • @Mythje:我会设置最大宽度
  • @Andre Backlund:我试图设置一个图像来澄清它,但我做不到,因为我没有足够的声誉:(
  • 你能把它上传到其他地方并链接到它吗?

标签: html html-table


【解决方案1】:
<style type="text/css">
    table, 
    td.col2 {width:100%}
    td.col1 {white-space:nowrap;}
</style>

<table>
    <tr>
        <td class="col1">Column 1 content here</td>
        <td class="col2">Column 2 content here</td>
    </tr>
</table>

【讨论】:

    猜你喜欢
    • 2023-03-15
    • 1970-01-01
    • 2021-12-16
    • 2021-07-18
    • 2021-11-27
    • 1970-01-01
    • 1970-01-01
    • 2013-01-16
    • 1970-01-01
    相关资源
    最近更新 更多