I have a situation where there can be long words like 'hellowordsometext' or integer like '1234567891122' without any space in between. check this js please. http://jsfiddle.net/rzq5e/6/
how is it possible to break it in to next line after it reach the div width. what happens now is, it spans out out along with th div
<div>Solutionforentprise</div>
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.
You can wrap a long string, which does not have any whitespace character by using the CSS word-wrap property, or overflow-wrap, if you use CSS3.
What you need is word-wrap: break-word;
, this property will force the non spaced string to break inside the div
Demo
div { width: 20px; word-wrap: break-word; }
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