简体   繁体   English

自动换行:替代词?

[英]word-wrap:break-word alternative?

I can't make it work on FF and Chrome while it plays well on IE/Opera. 我无法在FF和Chrome上运行,因为它在IE / Opera上运行良好。 I there a way to do it, even with Javascript/JQuery? 我有办法做到这一点,即使使用Javascript / JQuery?

Thank you. 谢谢。

That's a CSS attribute. 这是一个CSS属性。

I found this solution posted elsewhere, but haven't tried it. 我发现这个解决方案发布在其他地方,但没有尝试过。

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

If FF has trouble breaking a word when doing wrapping, a sure way to force it is to have a function that breaks up words over a certain length, inserting a character that ffox will break on. 如果FF在执行换行时遇到麻烦,强制它的一种可靠方法是使用一个函数来分解一定长度的单词,插入一个ffox会破坏的字符。 You can do a browser check to only do that on browsers that need it. 您可以执行浏览器检查,仅在需要它的浏览器上执行此操作。

要更好地控制位置,可以使用HTML元素

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

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