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

Sur*_*esh 3 html css

我正在将 min-width 和 max-width 设置为 TH 标签。最小宽度属性反映了最大宽度属性未反映的情况。当我检查并检查 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>
Run Code Online (Sandbox Code Playgroud)

小智 5

表格列会根据数据增加

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