具有混合固定宽度和流体列的HTML表

时间:2012-03-05 06:35:47

标签: html html-table fluid-layout fixed-width

我有一个用table-layout:fixed设计的表格。表格中有六列,我分别设置每列的宽度。对于某些列,其中的文本将被截断。有没有办法根据内容设置特定列(一列或两列)的宽度?

1 个答案:

答案 0 :(得分:0)

使用column group并使用以下语法将指定列的宽度设置为内容确定的最低要求值:

<table>
  <colgroup>
    <col width="30"><!--fixed width column-->
    <col width="0*"><!--minimum width of content column-->
  </colgroup>
  <tr>
    <td>
    <!--...-->
    </td>
  </tr>
</table>
相关问题