Joshua Joshua - 3 months ago 19
CSS Question

Stop word-wrap dividing words

body { word-wrap: break-word;}


I've been using that code (above) to fit the text in the
body
into it's container. However what I don't like about it, is that it breaks up words.

Is there another way where it will not break up words and only line break after or before a word?

EDIT: This is for use within a
UIWebView
.

Answer

use white-space: wrap;. If you have set width on the element on which you are setting this it should work.

update - rendered data in Firefox alt text