CSS Word Wrap with Pre

From Fratm.com

Jump to: navigation, search

How do you get word wrapping when using the PRE tag? This is a problem I ran into with running this wiki, a lot of times the preformatted text will want to cause a vertical scroll bar. So I did a google search and found this http://users.tkk.fi/~tkarvine/pre-wrap-css3-mozilla-opera-ie.html

CSS Code

/* 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 far it works for me.. I think I will create a class called NoWrapPre, and that way I can use both type of pre with out any problems.

Fratm 08:00, 19 April 2007 (PDT)

Personal tools