You can use CSS:
table { table-layout: fixed; width: 100%; } table td, table th { word-wrap: break-word; overflow-wrap: break-word; } table td, table th { white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; }
Here is an example: http://www.jsfiddle.net/QPP8A/ (now deprecated, sorry)
If you find this difficult to apply, you can use the wordwrap PHP function :
$text = "The quick brown fox jumped over the lazy dog."; $newtext = wordwrap($text, 20, "<br />\n");
source share