How can I make Firefox word-break with CSS?

我只是一个虾纸丫 提交于 2019-11-28 06:43:40
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
width:200px;

The above piece of code works for me wonderfully

Use the following rules together:

/* For Firefox */
white-space: pre-wrap;
word-break: break-all;

/* For Chrome and IE */
word-wrap: break-word;
Pankaj Pareek

You have to apply the below css class on div:

.content-div{
    word-break:break-all;
    word-wrap: break-word;
}

And add below style on table which is bind in div

style='table-layout:fixed;width:306px;'

It will work on IE7, FF 3.6 and Chrome.

you use width and display properties together with word-wrap property:

width: 100px;
word-wrap: break-word;
display:inline-block;

It works for me both in IE and in FF.

it works this way for Firefox:

word-break: initial;
word-wrap: break-word;

That work for me nicely:

/* For Firefox */
white-space: pre-wrap;
overflow-wrap: break-word;

/* For Chrome and IE */
word-wrap: break-word;

It looks overflow-wrap is something new in firefox. More info can be found here:

https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap

Hows about we try this:

div{ overflow-wrap:break-word; }

word-break: break-word is deprecated. You should use: word-break: normal; overflow-wrap: anywhere

I needed a combination of several answers to get it to work in both Chrome and Firefox for me:

.white-space-pre-wrap {
  white-space: pre-wrap;
  word-break: break-all;
  word-wrap: break-word;
  display: inline-block;
}
Ramya

Use the below styles it worked fine for me in mozilla firefox.

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