停止自动换行分割单词

2022-01-19 00:00:00 word-wrap css uiwebview
body { word-wrap: break-word;}

我一直在使用该代码(上图)将 body 中的文本放入它的容器中.然而,我不喜欢它,它打破了文字.

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?

这是在 UIWebView 中使用的.

推荐答案

使用 white-space: nowrap;.如果您在设置它的元素上设置了宽度,它应该可以工作.

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

更新 -在 Firefox 中呈现数据

update - rendered data in Firefox

相关文章