I usually handled this using a combination of word-wrap and <wbr> . Please note that there are several options. as you can see, ​ probably the best choice for compatibility.
word-wrap Browser support is not scary, everything is covered, Safari, Internet Explorer and Firefox 3.1 (Alpha Build) support it ( src ), so we can be not so far.
As for the server-side failure, I quite successfully used this method (php):
function _wordwrap($text) { $split = explode(" ", $text); foreach($split as $key=>$value) { if (strlen($value) > 10) { $split[$key] = chunk_split($value, 5, "​"); } } return implode(" ", $split); }
Basically, for words over 10 characters, I separate them by 5 characters. This seems to work for all the use cases that I have been given.
Owen Nov 27 '08 at 5:28 2008-11-27 05:28
source share