gpt4 book ai didi

html - 在分词前添加连字符

转载 作者:太空狗 更新时间:2023-10-29 15:46:13 24 4
gpt4 key购买 nike

也许这是不可能的,但我想知道是否有一种方法可以在打断单词之前自动在没有空格的长字符串末尾插入一个连字符?这jsfiddle演示了我遇到的问题。谢谢。

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博客文章解释了适用于其他浏览器的解决方案,但它在 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;
}

如果这在您需要的浏览器中不起作用,请查看 hyphenator - 一个 javascript 实用程序,可以更好地满足您的需求。

关于html - 在分词前添加连字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16498154/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com