Skip to content Skip to sidebar Skip to footer

Is There Any Way To Wrap Html Text When 'all One Word' Is Used?

Possible Duplicate: Is there a way to word-wrap text in a div? I have this css and html issue. I have a description and I want to fit it in a box that is 100px wide and I want t

Solution 1:

The most straight forward way is to use word-wrap: break-word

See it in action

Solution 2:

  1. CSS solution : use overflow:hidden and overflow-x:hidden

  2. Backend solution: if you are using a scripting language like php to generate your page, use "word wrap" technique to break the long word data.

Solution 3:

Please refer to this question.

word-wrap : break-word is the most compatible way going forward, but will not help in some browsers that are still widely used.

Solution 4:

change height to min-height and remove overflow and use word-wrap: break-word :

<divstyle="width:100px; border:1px Solid Black; min-height:200px;word-wrap: break-word; "><p>text here...</p></div>

but remember if user does not type any space, no browser will break it to multiple lines!

Post a Comment for "Is There Any Way To Wrap Html Text When 'all One Word' Is Used?"