Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Break long word with CSS

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> 
like image 442
dev1234 Avatar asked Sep 05 '13 04:09

dev1234


People also ask

How do you break a long word in CSS?

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.

What is word-break in CSS?

The word-break CSS property sets whether line breaks appear wherever the text would otherwise overflow its content box.

How do you break a word without space in CSS?

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.


1 Answers

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; } 
like image 109
Mr. Alien Avatar answered Oct 04 '22 04:10

Mr. Alien