Hi
Searching for a possibility to display some text with preserved white
space and line breaks, but with long lines being wrapped, I found this
CSS declaration, which I found helpful:
pre {
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+ */
}
(source: http://myy.helia.fi/~karte/pre-wrap-...-opera-ie.html)
Now if the preformatted block contains long words such as URLs, Firefox
and Internet explorer behave quite differently - FF lets them break the
element, while IE wraps at hyphens or (if there are none) just anywhere
in the text; I think both behaviours are possibly correct.
But if the preformatted block is inside a table, IE (6.0) does expand
the cell width to the with it had, if the long word was not wrapped!
Here's the test case:
http://www.markusernst.ch/stuff_for_.../pre_test.html
I assume that this is a bug in IE's own non-standard behaviour. Does
anybody know a workaround? Or is there a better way to achieve the
desired display?
(I could do the line wrapping at the server side, but this is likely to
break with differing font size or font face, specially as I will have to
define element widths in px rather than em. BTW also note that the em
width is different for the container and the pre elements in both UAs,
which is also disturbing...)
Thanks for your comments!
--
Markus