I need to display strings containing smileys made of ascii characters such as :-)
on a web page without them being split between two lines, especially when they are at the end of a line.
Does anyone have a solution for ensuring that the smiley is always displayed as a single "word" and not broken up?
EDIT 1 & 2
I want to clarify that in this case, a series of punctuation marks should not be considered a word. This distinction was causing issues for me. For example, if I had the word "comment" at the end of the line it wouldn't be split, but if I had ";.!,;:" then it would.
Additionally, the suggested answer did not mention using word-break: keep-all
, which was the solution I found to work. So I believe my input adds a unique perspective to the issue.