我可以定义哪些字符可以“中断”吗?一句话?
我在 Safari 扩展程序中显示了非常长的 URL。显然,它们不能放在一条线上。目前,断字规则使得大多数 URL 都位于两行上:第一行相当短,以 ?
符号结尾,另一行长得离谱,包含 的所有其余部分>获取
参数。
我想让单词也会在 &
符号上中断,如果可能的话,不会搞砸复制粘贴。我尝试用 &\u00ad
替换每个 &
(&
+ 软连字符),但这有点奇怪当 URL 中确实没有连字符时,可以看到 &
后面的连字符。
我以为 CSS3 中有一些东西可以解决此类问题,但我找不到它。
欢迎任何建议,只要它适用于 Safari。
I'm showing up veeeery long URLs in my Safari extension. Obviously, they can't fit on a single line. Currently, word breaking rules make it so most URLs are on two lines: the first one is rather short and ends with the ?
symbol, and the other is ridiculously long and contains all the rest of the GET
parameters.
I'd like to make it so words also break on the &
symbol, without screwing up copy-paste if possible. I've tried to replace every &
with &\u00ad
(&
+ the soft hyphen character), but it's kind of weird to see the hyphen after the &
when there really isn't any in the URL.
I thought there was something in store with CSS3 for that kind of problem, but I can't find it.
Any suggestion welcome, as long as it works with Safari.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
可能
就是您正在寻找的。Probably
<wbr>
is what you're looking for.
是一个很好的答案,但您也可以考虑零宽度空间实体。我用得不多,但是这篇文章 建议使用以下 css 来扩展跨浏览器功能:<wbr>
is a good answer, but you might also consider the zero-width space entity. I haven't used it much, but this article suggests using the following css to extend the cross-browser functionality: