我有一个表格,其中白色空间设置为nowrap,并且使用固定的表格布局限制列宽度。这正确地隐藏了Firefox中的长行,但在IE9中,这些行正在包装。
测试用例:
<table border="1" width=200 style="white-space: nowrap; table-layout: fixed;">
<tr>
<td style="overflow: hidden;" width=150>Word with some spaces that isnt working in IE</td>
<td width=50>100/50</td>
</tr>
<tr>
<td style="overflow: hidden;" width=150>LoooooooooOOOOOOOOOoooooooooooooooooongword</td>
<td width=50>550/50</td>
</tr>
<tr>
<td style="overflow: hidden;" width=150>AnotherLoooooooooooonnnnnnnnnnnnnnnnGWord</td>
<td width=50>660/50</td>
</tr>
</table>
火狐:
IE 9:
答案 0 :(得分:6)
使用严格的 doctype ,它在我的IE9中有效,我的结果与firefox相同。我已经用代码
进行了测试<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>
<body>
<form>
<table border="1" width=200 style="white-space: nowrap; table-layout: fixed;">
<tr>
<td style="overflow: hidden;" width=150>Word with some spaces that isnt working in IE</td>
<td width=50>100/50</td>
</tr>
<tr>
<td style="overflow: hidden;" width=150>LoooooooooOOOOOOOOOoooooooooooooooooongword</td>
<td width=50>550/50</td>
</tr>
<tr>
<td style="overflow: hidden;" width=150>AnotherLoooooooooooonnnnnnnnnnnnnnnnGWord</td>
<td width=50>660/50</td>
</tr>
</table>
</form>
</body>
</html>