1

Dynamically, my code receive some variables and join them with an underscore:

var text = product + "_" + someOtherInfo;

And I need to show this text inside a div.

div {
    max-width: 200px;
    /* ... */
}

The problem is occurring when the text gets more than 200px. I did a fiddle here.

The number of lines isn't a problem... So, I want to give a break line at max-width point.

Is it possible? Thanks in advance!

  • Have you tried soft hyphens? http://stackoverflow.com/questions/226464/soft-hyphen-in-html-wbr-vs-shy – tsnorri Mar 12 '15 at 13:20

1 Answers1

4
word-wrap:break-word;

Add this in your div style

FIDDLE

Guruprasad J Rao
  • 29,410
  • 14
  • 101
  • 200