views:

61

answers:

1

The pre tags in IE 7 do wrap the text but the table width will remain wider and scrollbar appears, as if the text is taking full space. This problem doesn't come in Firefox and Chrome. Can anyone help me out defining proper style for IE 7 for pre tags.

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

Thanks Smitha

A: 

Not sure if this would solve your problem http://vinhboy.com/blog/2009/02/13/ie7-table-width/

he has mentioned using table-layout: fixed;

Try this out and let us know

vsingh
Thanks a lot. It worked for me. Only one thing is, if I directly apply the table-layout:fixed style for the inner table, where my data is in different columns, all columns get same area irrespective of their defined width. So I applied it to the outer table, and it worked fine. Also this didn't work well with jsf datatables and panelgrids.Thanks a lot.Smitha
Smitha