Safari does a wonderful job wrapping text when white-space: pre;
is applied to <div>
s or <textarea>
s, like below.
<textarea style="width:300px; white-space:pre; word-wrap:break-word;"> text. dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd</textarea>
When a word reaches the max-width
of the textarea the entire word isn't moved down a line the way it is if you just use word-wrap: break-word;
. Instead, it splits the word at the max-width
and continues from the lower left newline. I'd like to be able to replicate this in all the major browsers, but I'd be satisfied with just Firefox and IE if it's too troublesome.
Any ideas/advice on how to achieve this would be much appreciated.