Wrapping the pre tag

Written by on December 2nd, 2006 in Ajax News.

Making preformated

 text wrap in CSS3, Mozilla, Opera and IE

is the tip that let’s you use the pre tag to keep the formatting, without cursing yourself when some of the content is too long and doesn’t 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+ */
}
 

Source: Ajaxian
Original Article: http://ajaxian.com/archives/wrapping-the-pre-tag

Leave a Reply

You must be logged in to post a comment.



Site Navigation