I have a text inside a div with a hyphen in it. When the div gets to small, the text overflows instead of breaking at the hyphen.
I tried a bit with word-break and overflow, but couldn't figure out how to fix this. Here is an example of what is happening, and what i am trying to achieve.
div{
width:70px;
border:1px solid;
}
<b>How it is now </b>
<div> bla bla-blablabla</div>
<br>
<b> What should happen: </b>
<div> bla bla-<br>blablabla</div>
Edit for the duplicate question: The answers there given are wrong.
- The best (by votes) answer suggests replacing hyphens by . This is incorrect, since those hyphens will NOT show up when there is no line break.
- The second answer suggests wbr, but this is not supported in all broswers.
- The third best answer suggests css word-wrapping, which does not make it break at hyphens.