2012-07-04 66 views
0

我有一个表空白设置为nowrap和列宽度限制使用表格布局固定。这正确地隐藏了Firefox中的长行,但在IE9中这些行正在打包。白色空间:nowrap不工作在IE 9

测试用例:

<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> 

火狐: enter image description here

IE 9: enter image description here

回答

6

使用严格DOCTYPE它在我的IE9,我有结果,作为同火狐。我已经用代码测试了

<!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> 
+0

很酷谢谢!不知道标签可以提供帮助 – waza123