2010-02-10 46 views
1

我試圖讓表格單元格的內容剪輯,而不是導致單元格高度增長。 IE8很好地工作,但當然IE6的行爲不一樣。還有什麼我可以添加到讓IE6行爲我想要的方式嗎?如何獲得溢出:隱藏在IE6中工作?

這裏是我的示例頁面的html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head> 
    <title></title> 
    <style type="text/css"> 
     table.grid 
     { 
      border-style:none; 
      border-color:#A0A0A0; 
      border-collapse:collapse; 
      width: 100%; 
      table-layout:fixed; 
     } 

     table.grid tr 
     { 
      background-color:#F0F0F0; 
     } 

     td 
     { 
      overflow:hidden; 
      text-overflow:ellipsis; 
      white-space:nowrap; 
     } 
    </style> 
</head> 
<body> 
    <table class="grid"> 
     <tr> 
      <td style="width:100%;">test</td> 
      <td style="width:100px;">test wide sentance</td> 
      <!-- Second cell should clip instead of growing in height --> 
     </tr> 
    </table> 
</body> 
</html> 

回答

3

表和overflow表現一般一件棘手的事情。如果可以,並且不會給您帶來無法忍受的副作用,請將div添加到列中,並將overflow: hidden應用於該列。

+0

謝謝!這有點破解,但相當乾淨。謝謝你的提示! – Jeremy 2010-02-10 18:34:48