Previous Message
Next Message

Pre-wrap alternatives

Sent by Justin Wignall on 11 April 2005 14:02


I have a page that displays the contents of mail sent through a CMS
system on a webpage.
 
I want  plain text mail to display line breaks where originally they
were entered WITHOUT adding <br /> tags or similar to the markup.
 
Using preformatting via the <pre> tag or white-space: pre; is not an
option as I need the lines to wrap. CSS2.1 pre-wrap is the answer only
it is not widely supported.
 
So far I've got to the point where
 
..wordwrap {  
 white-space: pre-wrap;       /* css-3 should we be so lucky... */
 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+ */
 _white-space: pre;   /* IE only hack to re-specify in addition to
word-wrap  */
 }
 
seems to work, it does as required on firefox, IE6 and Opera 7 (All
Win32)
 
Downside is obviously lack of validation and it generally being a mess.
 
Any ideas?
 
The majority of this code was lifted from Scott Mitchell at
http://scottonwriting.net/sowblog/posts/2272.aspx which came itself from
Lowel Meyer, the changes (maybe for the worse) are mine.
 
I'm not sure about the opera specific lines as pre-wrap seems to be
supported on my Opera 7.51 although I can't find documentation about
this.
 
Look forward in advance to any ideas and/or suggestions on how i can
better do this. Sorry for the length of message, I'm a css-dicuss newbie
and need to work on my requests ;)
 
Thanks,
 
Justin Wignall

This e-mail and any files transmitted with it are confidential to the University of Warwick
Students' Union and are intended solely for the use of the individual or entity to whom they are
addressed.  If you have received this e-mail in error, please contact the Warwick Students' Union IT
Department on 024 7657 2777.

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message