This project is read-only.

CSS word-break : break-word vs break-all

Jan 6, 2017 at 9:41 PM
I have a situation where I have td elements with a fixed width. If a word happens to be long enough that it will exceed the width of the cell, it will be placed on a new line.

However, if there is a single word on the new line, and that word exceeds the td width, that word will go past the boundary and be cutoff.

word-break:break-all takes care of this by breaking the word at the first letter that crosses they boundary, but word-break:break-word takes the whole word and moves it to the next line.

Is there any way to have the best of both worlds? I want the break-word functionality but I would like break-all if there is only one word on a line that exceeds the boundary.