I am looking for the best solution to allow text to wrap in the middle of a word if necessary. By best, I mean most browser-compatible, and will favor word breaks before it
I found a similar answer here: http://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/
A more robust browser support
CSS only
-ms-word-break: break-all;
/* Be VERY careful with this, breaks normal words wh_erever */
word-break: break-all;
/* Non standard for webkit */
word-break: break-word;
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
If your text is PHP generated you have a PHP function:
wordwrap
\n");
echo $newtext;
?>
Also, you can try PHP function explode if you have and know the delimiter. Display after with for loop (explode returns an array).