简体   繁体   English

为什么word-break:break-word在Firefox中不起作用?

[英]Why doesn't word-break:break-word work in Firefox?

I have a div and a table inside with paging: 我里面有一个div和一个分页的表:

 .wrapper tbody td { word-break:break-word; } 
 <div class="wrapper"> <table>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</table> </div> 

This CSS works fine for Chrome, but not for Firefox. 此CSS适用于Chrome,但不适用于Firefox。 So, when paging, my text is out of my div in Firefox. 因此,在分页时,我的文本不在Firefox的div中。

I also applied for Firefox the following CSS after reading How can I make Firefox word-break with CSS? 阅读了如何使用CSS使Firefox断字后,我还为Firefox申请了以下CSS。

.wrapper tbody td {
    word-break:break-all;
    word-wrap: break-word;
}

but now word-wrap:break-word is not working. 但是现在word-wrap:break-word不起作用。 Instead, word-break:break-all is working. 相反, word-break:break-all起作用了。 How can I force word-break: break-word; 我该如何强制word-break: break-word; to work in Firefox and break the words of my text like separate words? 在Firefox中工作并像单独的单词一样打断我的文字单词?

Valid syntax for word-break is: word-break有效语法为:

 word-break: normal | break-all | keep-all;

The word-break: break-word; word-break: break-word; property is a non-standard WebKit implementation only. 属性仅是非标准的WebKit实现。 Since Firefox doesn't use the WebKit rendering engine, that property value won't work in Firefox. 由于Firefox不使用WebKit呈现引擎,因此该属性值在Firefox中不起作用。

Use only word-wrap: break-word; 仅使用自动换行:break-word; instead of word-break:break-all; 代替单词break:break-all;

.wrapper tbody td {

 word-wrap: break-word;

  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM