Karl Seguin Karl Seguin - 8 days ago 6
CSS Question

How to word-break on a dash?

Given a relatively simple CSS:



div {
width: 150px;
}

<div>
12333-2333-233-23339392-332332323
</div>





How do I make it so that the string stays constrained to the
width
of 150, and simply wraps to a newline on the hyphen?

Answer

Replace your hyphens with this:

&shy;

It's called a "soft" hyphen.