How do you force line breaks between words only in css/html?

家住魔仙堡 提交于 2019-12-23 12:28:28

问题


I have just a regular piece of text in a <p> tag inside a <div> tag. But only Firefox displays it correctly.

Firefox breaks the lines between the words. All other browsers break the line mid-word which makes it difficult to read.

Here is an example of what I mean:

Firefox (working):

This was busy in it was I was here. Let 
him as being within eight by their 
graves, to go down upon her to be a 
dozen directly. So, leaving word 
following, poor mother, of other man, 
and my finger on his blue flag, and the 
habit of tea on a bit. I might feel 
very sorry there is rich, too; late of 
his deepest voice...

All other browsers (IE5-8, safari, chrome) (not working:)

This was busy in it was I was here. Le
t him as being within eight by their g
raves, to go down upon her to be a doz
en directly. So, leaving word followin
g, poor mother, of other man, and my f
inger on his blue flag, and the habit 
of tea on a bit. I might feel very sor
ry there is rich, too; late of his dee
pest voice...

How do I make this work for all browsers?


回答1:


Somewhere in your css you probably have word-wrap: break-word. Find it and change it to word-wrap: normal (or simply remove the word-wrap element altogether).




回答2:


For text to break on his own just add padding on left and right side to the container (div, td etc.) of text.



来源:https://stackoverflow.com/questions/2259688/how-do-you-force-line-breaks-between-words-only-in-css-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!