when pulling data from a database.. particularly a text field.. sometimes you just watn to pull it out the way it was put in. peole make new lines (\n) and they also type full paragraphs worth of text.. wouldn't it be nice to be able to pull it out and have it format nicely with your page?
Unfortunately there is no easy way to do this. the pre tag in html and the general white-space declaration in CSS do not allow for such a thing to happen. the values normal, pre and nowrap all do things you want, but you want to combine them.
the pre-wrap value for the white-space attribute has been in the draft for the next version of CSS for awhile. Opera currently supports this just fine, but of course.. that's Opera.. the elite cannot speak for the peasants now can they.
anyway.. so after much searching i found out it can be done... it just takes a bit of hacking:
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+ */
}
It works.. it's not pretty.. it's not valid.. it's not really right in any way.. but who cares.. we're developers! not conformists to standards. things must be done!



