I'm trying to get the text in a div with a fixed width to break on a letter instead of a word. I cant really think of a way to explain it so I made a little example. Any help would be greatly appreciated.
What happens now.
|Hello |
|World! |
What I want:
|Hello Wo|
|rld! |
The text-align-last property in CSS is used to set the last line of the paragraph just before the line break. The line break may be due to the natural ending of a paragraph, or it may be due to the use of <br> tag.
The word-break property in CSS is used to specify how a word should be broken or split when reaching the end of a line. The word-wrap property is used to split/break long words and wrap them into the next line. word-break: break-all; It is used to break the words at any character to prevent overflow.
The word-break CSS property sets whether line breaks appear wherever the text would otherwise overflow its content box.
The text-align-last CSS property sets how the last line of a block or a line, right before a forced line break, is aligned.
word-wrap: break-word;
As per the CSS W3 Spec:
An unbreakable "word" may be broken at an arbitrary point if there are no otherwise-acceptable break points in the line. Shaping characters are still shaped as if the word were not broken, and grapheme clusters must together stay as one unit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With