Css表列宽“按原样”

时间:2012-06-23 12:30:10

标签: html css width css-tables

有没有办法指定表格列宽“按原样”。换句话说,我希望列具有确切的宽度,其内容可以显示。

1 个答案:

答案 0 :(得分:2)

这应该是默认情况。

<!-- "table-layout" is "auto" by default as well, just to force it -->
<table border="1" style="table-layout:auto;">
    <tr>
        <td>Column 1</td>
        <td>Column 2</td>
    </tr>
</table>

This is how it looks like