Table中<th>标签如何设置Max-width,<th>是否支持Max-width?

新手上路,请多包涵

我将 min-width 和 max-width 设置为 TH tag 。 Min-width 属性反映了 max-width 属性未反映的地方。当我检查并检查 TH 标签时,它看起来只应用了

<table>
<thead>
<tr>
    <th> S.No </th>
    <th> Name </th>
    <th style="min-width:40px; max-width:150px;"> Description </th>
    <th> Gender </th>
</tr>
</thead>
<tbody>
<tr>
    <td> 1 </td>
    <td> Xyz </td>
    <td> Having Excess content more than 160 characters </td>
    <td> Male/Female </t>
</tr>
</tbody>
</table>

原文由 Suresh 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.2k
1 个回答

表格列会根据数据增加

  1. 行内宽度不起作用
  2. 你能做什么 固定表格布局 table(table-layout:fixed;)
  3. 然后为列分配宽度

原文由 Head In Cloud 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题