How to word wrap text in HTML?

Satya Kalluri picture Satya Kalluri · Jul 18, 2009 · Viewed 487.5k times · Source

How can text like aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa which exceeds the width of a div (say 200px) be wrapped?

I am open to any kind of solution such as CSS, jQuery, etc.

Answer

Alan Haggai Alavi picture Alan Haggai Alavi · Jul 18, 2009

Try this:

div {
    width: 200px;
    word-wrap: break-word;
}