The following snippet is a catch-all for word-wrapping:
.class_name {
-ms-word-break: break-all;
word-break: break-all;
/* Non standard for webkit */
word-break: break-word;
-webkit-hyphens: auto;
-moz-hyphens: auto;
-ms-hyphens: auto;
hyphens: auto;
}
word-break: break-all
will work except for IE8 and Firefox, so you need the ms-word-break
prefixed line included as well. As usual, IE8 requires that its prefixed line be added first. This doesn't solve it for Firefox, however.
In FF, you need to use a new item called hyphenations
, which is supported except for Chrome (but it's okay, because Chrome will use the basic word-break: break all
) in this lengthy list: -webkit-hyphens: auto; -moz-hyphens: auto; -ms-hyphens: auto; hyphens: auto;
.
Hyphenation
will insert hyphens at the correct location for word-breaks, which is a better solution than just splitting a word in two.
More information on why this is a catch all.