Code Snippet
Make “Pre” Text Wrap
Text in <pre> tags doesn't wrap by default. For example, see the code snippet below! If this is causing layout problems, one solution is to give the pre block an overflow property to hide the excess or cause it to scroll. The other solution is to have it wrap.
/* Browser specific (not valid) styles to make preformatted text wrap */
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+ */
}
So, does o-pre-wrap work in Opera 8, 9, and 10 as well?
And what of web-kit browsers? (I sincerely hope they support the CSS3 declaration itself.)
After all the Google searching I feel like doing, this solution is the only one that pops up anywhere. It seems rather outdated…
doesn’t work in Opera 10 and IE8