3

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?

denniss
  • 17,229
  • 26
  • 92
  • 141
  • Does this answer your question? [How to word wrap text in HTML?](https://stackoverflow.com/questions/1147877/how-to-word-wrap-text-in-html) – luke77 May 18 '20 at 06:46

3 Answers3

3
<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

Community
  • 1
  • 1
Dr. Rajesh Rolen
  • 14,029
  • 41
  • 106
  • 178
0

using css you can achieve

word-wrap:break-word

Style

div {
    word-wrap: break-word;
}

HTML

<div>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div>
Harish
  • 2,311
  • 4
  • 23
  • 28
0

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

Sachin Shanbhag
  • 54,530
  • 11
  • 89
  • 103