[I didn’t know that] Why the div was not able to contain text within it’s width

by currentricity

Suppose I have a div such as
<div style="width:100px"> asdflkjfdlkasdfjlksdafjlksadfjldksfjlkadfjlkdjfkldajflkd</div>

The enclosed text will still flow out of the div because the browser doesn't know where to insert a new line. You will need to modify the above code like this

<div style="width:100px; word-wrap:break-word;"> asdflkjfdlkasdfjlksdafjlksadfjldksfjlkadfjlkdjfkldajflkd</div>
Advertisements