To stop words from breaking, you should unset word-break
. The default is normal
, which allows word breaks but at break points.
overflow-wrap
controls when word breaks happen.
You should instead set the overflow-wrap
property to always
to break words only when they are too long to fit on a line (instead of overflowing).
The default normal
to disable word breaks, allowing words too long to overflow the edge of the element.
If your element width is flexible (e.g. min-width, or display:flex), and you want too expand the element instead of line breaking, you can use the value break-word
.
The property word-break
determines whether words should only break at break points, or always (when they could overflow).
Helpful info and demo on overflow-wrap - MDN Web Docs
Info on word-break
Further things:
- If you want to disable all word breaks, even when it can't line break, i.e. japanese text, you can use the
word-break: keep-all
- *The value
break-word
may have been unsupported and is now deprecated, as is the word-wrap
CSS property (initially added by MS for this same function).
word-wrap: normal;
doesn't help. Nor doeswhite-space: wrap;
alone help if you are trying to wrap words in a table cell (my situation). – Devinne