Wrap a word without spaces in a div

css, html, whitespace

Solution

Try this:

word-wrap:break-word;

Problem

I have a div that is of fixed width, 300px. I have user inputed text that needs to go into the div. The issue is, is that people are putting the word "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" into the div. This causes the text to exceed the width of the div. What I would like is for the text to wrap even if there is no spaces in the words. Is there a way to do this with css? I tried the css `white-space` property but it was not working. If anyone has a solution or a point in the the right direction would be wonderful.

Original source