Click to See Complete Forum and Search --> : making text in a div wrap?
BrownWarrior
04-27-2010, 02:54 PM
Hi,
I am injecting some text into a div with my backend. If the text is a very long word without and spaces then it just carries on past the right edge of the div. How do I make it so that it wraps and carries on on a new line?
Thanks.
By inserting zero width spaces (http://www.fileformat.info/info/unicode/char/200b/index.htm)
BrownWarrior
05-06-2010, 07:30 PM
Hi Fang, Thanks for the reply! sorry about my slow reply, I was waiting until I had time to properly look at the link you gave me.
I don't think this is quite the solution to my problem though. The problem is that I have a textarea that I use to collect a testimonial that is then displayed on the site. I just noticed that if I just hold a key down and create a long line of a letter that if breaks out the div it is displayed in on the site. In reality this is never going to be a problem because nobody is going to leave a testimonial that is a long line of a letter. But it's just not nice to see that it can break like this. I think the problem is that the paragrahs that are collected from the textarea are not wrapped in <p> tags, if they were would this help? if so how do I format the innerHtml of the textarea into html?
This is back-end processing; converting the return characters (\r\n) to<br> or <p>.
Ask in the relevant forum.
As for long words that will overflow the container, this only occurs with URLs. Also solvable with back-end replacement using zero width spaces.
agabrel
05-07-2010, 10:24 AM
Try this:
white-space:normal;
http://www.w3schools.com/css/pr_text_white-space.asp