denniss
denniss

Reputation: 17589

text wrapping for one long word

How do i make a text wrap inside a div so that even one long word will be wrapped not only nicely spaced words? do i need js to do this?

Upvotes: 3

Views: 1593

Answers (3)

Harish
Harish

Reputation: 2324

using css you can achieve

word-wrap:break-word

Style

div {
    word-wrap: break-word;
}

HTML

<div>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div>

Upvotes: 0

Sachin Shanbhag
Sachin Shanbhag

Reputation: 55479

you can use word-wrap: break-word; in your css for the div.

Upvotes: 0

Dr. Rajesh Rolen
Dr. Rajesh Rolen

Reputation: 14285

<div style=”word-wrap: break-word”>Here is some content for the div element</div> 

found similar question: How to word wrap text in HTML?

References:

http://www.css3.com/css-word-wrap/

http://www.1keydata.com/css-tutorial/wrap.php

http://bytes.com/topic/html-css/answers/627827-how-wrap-text-css

Upvotes: 3

Related Questions