I'm using word-break: break-all;
and want to know how I can have the browser automatically insert the hyphens, as demonstrated in an MDN example.
div {
width: 80px;
height: 80px;
display: block;
overflow: hidden;
border: 1px solid red;
word-break: break-all;
hyphens: auto;
-ms-hyphens: auto;
-moz-hyphens: auto;
}
<div>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div>
Such that the text would look like this:
aaaaaaaa-
aaaaaaaa-
aaaaaaaa-
aaaaaaaa
I created a JSFiddle too.
This needs to work in IE9/IE10, but it'd be nice if it'd work in Firefox and Chrome as well.