MultiformeIngegno
MultiformeIngegno

Reputation: 7049

max-width doesn't work with long words

I have a div with paragraphs. I'd like to set a max-width. It works, the problem is that long words don't wrap...

Example: http://jsfiddle.net/multiformeingegno/s8qE3/

<div style="max-width:100px">
<p>Something Something! BASTAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA!!!!!<br/>

Upvotes: 1

Views: 541

Answers (2)

Abubakr
Abubakr

Reputation: 312

You can apply the following CSS code:

p {
    word-wrap:break-word
}

This will cause your paragraphs to wrap on words.

Upvotes: 3

Fillip Peyton
Fillip Peyton

Reputation: 3657

Add word-wrap to your CSS:

p{ word-wrap: break-word; }

http://jsfiddle.net/fmpeyton/bH2Ne/

Upvotes: 2

Related Questions