在断字之前添加连字符 [英] Add hyphen before word-break
问题描述
也许这是不可能的,但我想知道是否有一种方法自动插入一个连字符到一个长字符串的结尾,没有空格之前打破一个字?此 jsfiddle 演示了我遇到的问题。谢谢。
Maybe this is not possible, but I was wondering if there is a way to automatically insert a hyphen to the end of a long string with no whitespace before breaking a word? This jsfiddle demonstrates the issue I am having. Thank you.
table {
width:200px;
word-wrap:break-word;
table-layout: fixed;
}
<table>
<td>Pneumonoultramicroscopicsilicovolcanoconiosis</td>
</table>
推荐答案
我认为你最好的选择是javascript解决方案。
I think your best bet would be a javascript solution.
There is a
hyphens
property in css3, does not do exactly what you want (at least not in all browsers yet) I think, but might be interesting, you can read on it here or here.
或者这里讨论一下, b $ b 断字符: wordwrap非常长的字符串
Or here they discuss it a little too and mention a javascript plugin hyphenator: wordwrap a very long string
希望其中一些帮助。
这篇关于在断字之前添加连字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!