也许这是不可能的,但我想知道是否有一种方法可以在打破单词之前自动在长字符串的末尾插入一个连字符,并且没有空格?这jsfiddle http://jsfiddle.net/76qBy/演示了我遇到的问题。谢谢。
table {
width:200px;
word-wrap:break-word;
table-layout: fixed;
}
<table>
<td>Pneumonoultramicroscopicsilicovolcanoconiosis</td>
</table>
对于 webkit 浏览器,这应该有效:
table
{
width: 200px;
word-break: break-word;
-webkit-hyphens: auto;
}
这适用于 iOS Chrome,但不适用于 OS X Chrome。This http://blog.kenneth.io/blog/2012/03/04/word-wrapping-hypernation-using-css/博客文章解释了其他浏览器的解决方案,但它在 OS X Chrome 上仍然不适用于我。
显示的解决方案是:
table
{
-ms-word-break: break-all;
word-break: break-all;
// Non standard for webkit
word-break: break-word;
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
}
如果这在您需要的浏览器中不起作用,请查看连字符 https://code.google.com/p/hyphenator/- 一个 JavaScript 实用程序,可以更好地完成您的需要。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)