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
There's a huge difference. break-all
is basically unusable for rendering readable text.
Let's say you've got the string This is a text from an old magazine
in a container which only fits 6 chars per row.
word-break: break-all
This i
s a te
xt fro
m an o
ld mag
azine
As you can see the result is awful. break-all
will try to fit as many chararacters into each row as possible, it will even split a 2 letter word like "is" onto 2 rows! It's ridiculous. This is why break-all
is rarely ever used.
word-wrap: break-word
This
is a
text
from
an old
magazi
ne
break-word
will only break words which are too long to ever fit the container (like "magazine", which is 8 chars, and the container only fits 6 chars). It will never break words that could fit the container in their entirety, instead it will push them to a new line.
This is a text from an old magazine
This is a text from an old magazine