首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么在Firefox中不能使用word-break:break-word?

为什么在Firefox中不能使用word-break:break-word?
EN

Stack Overflow用户
提问于 2014-05-19 17:21:58
回答 2查看 206关注 0票数 1

我有一个div和一个带分页的表:

代码语言:javascript
复制
.wrapper tbody td {     
    word-break:break-word;
}
代码语言:javascript
复制
<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>

这个CSS在Chrome上运行良好,但在Firefox上就不行了。因此,当分页时,我的文本不在Firefox中的div中。

在阅读了How can I make Firefox word-break with CSS?之后,我也申请了下面的CSS

代码语言:javascript
复制
.wrapper tbody td {
    word-break:break-all;
    word-wrap: break-word;
}

但现在word-wrap:break-word不起作用了。相反,word-break:break-all正在发挥作用。如何强制word-break: break-word;在火狐中工作,并将文本中的单词分割为单独的单词?

EN

回答 2

Stack Overflow用户

发布于 2014-05-19 17:33:39

word-break的有效语法为:

代码语言:javascript
复制
 word-break: normal | break-all | keep-all;

word-break: break-word;属性只是一个非标准的WebKit实现。因为火狐没有使用WebKit渲染引擎,所以该属性值在火狐中不起作用。

票数 1
EN

Stack Overflow用户

发布于 2014-05-19 17:28:09

只使用换行: break-word;而不是word-break:break-all;

代码语言:javascript
复制
.wrapper tbody td {

 word-wrap: break-word;

  }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23734084

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档