【发布时间】:2012-03-05 06:35:47
【问题描述】:
我有一张使用table-layout:fixed 样式的表格。表格中有六列,我分别设置每列的宽度。对于某些列,其中的文本被截断。有没有办法根据内容设置特定列(一列或两列)的宽度?
【问题讨论】:
标签: html html-table fluid-layout fixed-width
我有一张使用table-layout:fixed 样式的表格。表格中有六列,我分别设置每列的宽度。对于某些列,其中的文本被截断。有没有办法根据内容设置特定列(一列或两列)的宽度?
【问题讨论】:
标签: html html-table fluid-layout fixed-width
使用column group 并使用以下语法将指定列的宽度设置为由内容确定的最小要求值:
<table>
<colgroup>
<col width="30"><!--fixed width column-->
<col width="0*"><!--minimum width of content column-->
</colgroup>
<tr>
<td>
<!--...-->
</td>
</tr>
</table>
【讨论】:
"30" 是硬编码的宽度,"0*" 是基于内容的宽度。