HTML Automatic line-break doesn't work?

Luke picture Luke · Jul 31, 2012 · Viewed 27.2k times · Source

I declared width and margins but somehow my lines didn't get wrapped with an automatic line-break.

enter image description here

edit: I found the cause. It's because there are no spaces between words:

teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest 

Answer

mswiszcz picture mswiszcz · Jul 31, 2012

The element where text is should have css declaration:

div {
    display: block;
    width: 200px; /*based on how much width this div should have*/
}

and if it doesn't work try doing:

div { word-wrap: break-word }