Search code examples
htmlcssword-wrap

How to word wrap text in HTML?


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.


Solution

  • Try this:

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