HTML 中的软连字符(<wbr> 与 &shy;) [英] Soft hyphen in HTML (<wbr> vs. &shy;)
问题描述
您如何解决网页上软连字符的问题?在文本中可能有很长的单词,您可能希望用连字符换行.但是您不希望连字符显示整个单词是否在同一行.
How do you solve the problem with soft hyphens on your web pages? In a text there can be long words which you might want to line break with a hyphen. But you do not want the hyphen to show if the whole word is on the same line.
根据对本页的评论
是一种非标准的由 Netscape 发明的标签汤".似乎 ­
在标准合规性方面存在问题还有.似乎无法为所有浏览器提供可行的解决方案.
According to comments on this page <wbr>
is a non standard "tag soup invented by Netscape". It seems like ­
has its problems with standard compliance as well. There seems to be no way to get a working solution for all browsers.
您处理软连字符的方式是什么,为什么选择它?是否有首选的解决方案或最佳做法?
Which is your way for handling soft hyphens and why did you choose it? Is there a preferred solution or best practice?
<小时>请在此处查看相关的 SO 讨论.
See related SO Discussion here.
推荐答案
不幸的是,­
的支持在浏览器之间是如此不一致,以至于无法真正使用.
Unfortunately, ­
's support is so inconsistent between browsers that it can't really be used.
QuirksMode 是正确的——目前没有在 HTML 中使用软连字符的好方法.看看没有它们你能做什么.
2013 年根据 QuirksMode,­
现在适用于所有主要浏览器.
2013 edit: According to QuirksMode, ­
now works/is supported on all major browsers.
这篇关于HTML 中的软连字符(<wbr> 与 &shy;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!