我有一个表格用作网页上的工具栏。除了IE7之外,它在所有浏览器中都很好用。问题在于它扩展了表格以适合内容(将内容从屏幕上移除),除非我在CSS中指定了“table-layout:fixed”。当我将表格布局设置为固定时,它将使所有单元格的大小相同,但我希望它们自动调整大小以适合内容(如果需要,还可以自动换行)。在单元格上设置“width:auto”不会执行任何操作。在IE7中使用“table-layout:fixed”表的表格单元格宽度
下面是HTML:
<table id="ToolbarTable" cellspacing="0px">
<tr>
<td class="ToolbarCell" align="center">
Button1
</td>
<td class="ToolbarCell" align="center">
Button2 Button3 Button4
</td>
<td class="ToolbarCell" align="center">
Button5 Button6 Button7 [Button8 Button9 - not always visible]
</td>
</tr>
</table>
而CSS:
#ToolbarTable
{
margin-top: 1px;
width: 100%;
min-height: 24px;
table-layout: fixed;
word-wrap: break-word;
}
#ToolbarTable td
{
min-width: 50px;
width: auto;
border: solid 1px #000000;
}
在IE7中,我怎样才能使一个表中的特定宽度(并有IE7公司微博吧),同时还让表格单元格的宽度会自动调整大小?
编辑:添加代码示例。
是的,我可以手动设置,但有时会显示比其他时间更多的按钮,我不想根据它在那一刻的内容重新计算每个单元格的宽度,我只想让IE7自动调整大小单元格和表格宽度:( – toby 2011-02-14 19:41:35
对不起,我不知道,IE也给我带来了很多麻烦,它总是造成麻烦。 – Aidiakapi 2011-02-15 16:46:09