2

IE 7中的pre標籤包裝文本,但表格寬度將保持更寬,並出現滾動條,就好像文本佔滿了空間。這個問題不在Firefox和Chrome中。任何人都可以幫助我爲IE 7預定義標籤定義正確的樣式。IE7 - 長字符串,預標籤寬度和表格寬度被忽略

<html> 
<style type="text/css"> 
<!-- 

pre { 
overflow:wrap; 
width: 600px; 
white-space: pre-wrap;  /* css-3 */ 
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ 
white-space: -pre-wrap;  /* Opera 4-6 */ 
white-space: -o-pre-wrap; /* Opera 7 */ 
word-wrap: break-word;  /* Internet Explorer 5.5+ */ 
display: block; 
} 
--> 
</style> 
<body> 
<table width="70%" border="1"> 
<tr> <td width="100%"> 
<pre> sdhgf jdhgfjd gfjs dfsjhdgfjs dgfjsdgfjsdhgfjsgdjf sdjfhgsj hkdjhfs kdhf kshf kshd dfgjshdgfjhsgdfjshgdjfhg sjdhgfjsdhgfjs hdgfjhsgd dbfbdmfsmd bfmsdnbf mdsnbfffffffff ffffffff ffffffffmdbmfsbf wehjgggggggggggggggggggg</pte> 
</td> </tr> </table> 
</body> 
</html> 

感謝 Smitha

回答

2

不知道這是否會解決您的問題http://vinhboy.com/blog/2009/02/13/ie7-table-width/

他已經使用表格的佈局中提到:固定;

試試這個,讓我們知道

+1

非常感謝。它爲我工作。只有一件事是,如果我直接對內部表應用table-layout:fixed樣式,其中我的數據位於不同列中,則所有列都會獲得同一區域,而不考慮其定義的寬度。所以我將它應用到了外表,並且它工作正常。此外這不適用於jsf數據表和panelgrids。 非常感謝。 Smitha – Smitha 2010-08-20 21:10:16