Tutorials4u.net Forum

Full Version: Solution for <pre></pre> to keep the format
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
You can use CSS to make the 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+ */

If you don't want the text formatting changed at all, this CSS will use scrollbars to make all of the text viewable anyway:

pre {
width: 100%;
overflow: auto;
Reference URL's