HTML中的软连字符(< wbr> vs& shy;) [英] Soft hyphen in HTML (<wbr> vs. ­)

查看:494
本文介绍了HTML中的软连字符(< wbr> vs& shy;)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何用网页上的软连字符解决问题?在文本中可能会有很长的单词,您可能想用连字符换行。但你不希望连字符显示整个单词是否在同一行。



根据本页 < wbr> 是Netscape发明的非标准标签汤。看起来像& shy; 在遵守标准方面也存在问题。似乎没有办法为所有浏览器获得工作解决方案



这是您处理软连字符的方式,您为什么选择它?是否有首选解决方案或最佳做法?





查看相关SO讨论 here

解决方案

不幸的是,& shy 的支持在浏览器之间非常不一致,以至于无法真正使用。



QuirksMode是对的 - 现在没有好方法在HTML中使用软连字符。看看你可以做些什么,没有他们。



2013编辑:根据QuirksMode ,现在所有主流浏览器都支持& shy; 。 $ b

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.

According to comments on this page <wbr> is a non standard "tag soup invented by Netscape". It seems like &shy; 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?


See related SO Discussion here.

解决方案

Unfortunately, &shy's support is so inconsistent between browsers that it can't really be used.

QuirksMode is right -- there's no good way to use soft hyphens in HTML right now. See what you can do to go without them.

2013 edit: According to QuirksMode, &shy; now works/is supported on all major browsers.

这篇关于HTML中的软连字符(&lt; wbr&gt; vs&amp; shy;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆