[thelist] CSS White-space

William Hutton hutton.billy at verizon.net
Thu Aug 15 12:41:01 CDT 2002

I have a very large text string, varchar(4000), in a SQL database that I'd like to display.  Here's the problem;

If I place it inside a <p> tag, I lose the text formatting in the string; spaces, carriage returns, line-feeds, etc.

If I place it inside a <pre> tag, I get the test formatting, but I lose the word-wrap.  :(

After doing some research, as best as I can tell, an in-line style sheet for the <p> tag would fix my problem, but I can't seem to get it to work.  Here's the page I found;


And it seems that the following should accomplish what I need;

<p STYLE="white-space: -pre-wrap">foo</p>

However, even this simple test doesn't seem to work;

<p style="white-space: pre">
This should be preformatted text;

   But is it?
   Is it?!

If I change the <p> tags to <pre>, the text displays with the propper formatting.  I wanted to see if ANY of the white-space style sheet attributes worked.  I think these are supposed to be supported in HTML 4.0, and IE5.5+.  I'm using IE6.

Anyone have a suggestion?  Either to get this to work, or some other way to accomplish my goal?


More information about the thelist mailing list