36

Possible Duplicate:
wrapping the text inside div - css

Fiddle: http://jsfiddle.net/aTFK2/2/

HTML:

<div id="ChannelDescription">ThisIsAVeryLongTextWithoutAnySpacesLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmedLoremIpsumDolorSitAmed</div>​

CSS:

#ChannelDescription {
  width:560px;
  color:Gray;
  white-space:normal;
  font-size:14px;
}​

NOTE: I cannot change the width to any other value. Neither can I use break points. I am looking for a pure CSS2 solution.

Community
  • 1
  • 1
Ashwin Singh
  • 7,197
  • 4
  • 36
  • 55
  • It's work till IE7 check this http://caniuse.com/#search=word-wrap – sandeep Aug 14 '12 at 06:33
  • 2
    Check this also http://stackoverflow.com/questions/1638223/is-there-a-way-to-word-wrap-text-in-a-div – sandeep Aug 14 '12 at 06:34
  • 1
    Yes its was what I was looking for, was in the belief that CSS3 compatibility is fairly limited in browsers, but his answer worked. thanks. – Ashwin Singh Aug 14 '12 at 06:36

1 Answers1

72

word-wrap: break-word; will solve the problem.

Noah Wetjen
  • 1,695
  • 2
  • 17
  • 30