【发布时间】:2012-01-02 16:44:28
【问题描述】:
如何将单个表格列固定为特定宽度,以便无论该列中有多少文本,列的宽度都保持不变?
<col> 标签只适用于火狐
table-layout:fixed 真的是整张桌子
仅仅设置一个width 是不行的
最好的 CSS 属性是什么
下面是代码:
.video{
overflow:hidden;
table-layout:fixed;
max-width:146px;
}
.audio{
overflow:hidden;
table-layout:fixed;
max-width:146px;
}
.image{
overflow:hidden;
table-layout:fixed;
max-width:146px;
}
.qid2{
overflow:hidden;
table-layout:fixed;
max-width:92px;
}
<table border=1 id="vidtbl">
<tr>
<th>Question No</th>
<th>Video</th>
<th>Audio</th>
<th>Image</th>
</tr>
<tr>
<td class="qid2"></td>
<td class="video">images/dolphinvideo.png//////////////////////////////////////</td>
<td class="audio">hello</td>
<td class="image"></td>
</tr>
</table>
【问题讨论】:
-
你试过在td标签中设置宽度吗?
标签: html css html-table width