I am currently wondering what is the difference between the two. When I used both they seem to break the word if it is not fitting the container. But why did W3C made two wa
From the respective W3 specifications —which happen to be pretty unclear due to a lack of context— one can deduce the following:
word-break: break-all
is for breaking up foreign, non-CJK (say Western) words in CJK (Chinese, Japanese or Korean) character writings.word-wrap: break-word
is for word breaking in a non-mixed (let us say solely Western) language.At least, these were W3's intentions. What actually happened was a major cock-up with browser incompatibilities as a result. Here is an excellent write-up of the various problems involved.
The following code snippet may serve as a summary of how to achieve word wrapping using CSS in a cross browser environment:
-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;