css - 跨浏览器断字 - 在 Opera 12 中不起作用

标签 css opera word-break

我有这个 css 类用于在没有空格的长文本中进行分词。

    .wrapword{
        white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
        white-space: -o-pre-wrap;    /* Opera 7 */
        white-space: pre-wrap;       /* css-3 */
        word-wrap: break-word;       /* Internet Explorer 5.5+ */
        word-break: break-all;
        white-space: normal;
    }

适用于 firefix 27、chrome 33、IE 10 和 midori 0.43,但不适用于 opera 12。 有什么建议。我不是 CSS 忍者......

最佳答案

从 Opera 13 开始,您的 CSS 可以正常工作,请参阅 http://caniuse.com/word-break .但是 Opera 12 不支持这个规则。

更好的解决方案是超文本化。但这通过 CSS 效果更差,请参阅 http://caniuse.com/css-hyphens .

所以我最好的猜测是:您可能想使用像 https://code.google.com/p/hyphenator/ 这样的 Javascript在文本中添加连字符。

关于css - 跨浏览器断字 - 在 Opera 12 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22144181/

相关文章:

HTML :first-child not giving desire result

css - 如何用父元素的背景填充内部元素的边距产生的空白区域?

css - 为什么 Opera (11.00) 不显示自定义 (@font-face) 字体?

android - Qt 网络服务器与移动浏览器

html - 如何防止一个符号的跨度出现在该行的第一行?

css - 在 Rails View 中打破用户输入的长词

html - CSS 隐藏 :overflow not working with absolute position?

css - 在 AngularJS 中调整元素高度

javascript - Opera 中的 SetInterval 导致选择闪烁

css - 一个单词一个单词地打断一个长句子