Let’s say I have the following paragraph tag:
<p>10 andSomeQuiteLongWord</p>
If I use word-break: break-word
or overflow-wrap: anywhere
, the word breaks as expected but also gets to a new line, like this:
|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|
|10 |
|andSomeQuiteLongW|
|ord |
|_________________|
I would like to display it as such:
|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|
|10 andSomeQuiteLo|
|ngWord |
|_________________|
Is there a way to achieve this?
2
Answers
word-break
usingbreak-all
should do it:The word-break CSS property is used to specify whether lines within words should be broken.
https://developer.mozilla.org/en-US/docs/Web/CSS/word-break
The overflow-wrap property is used to specify whether the browser can break lines within words to prevent overflow when an unbreakable sequence of characters is too long to fit in its containing box.
https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap