本文主要是介绍Zero-width non-breaking space,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
问题:
网页上面“5%”被分成了两行,“10%”在一行内,需要把5%也保持在一行内。
Update:
 在OS X的chrome中不起作用,需要换成‍或者‍
解决方法:
http://stackoverflow.com/a/11393767/2177408
There is no entity reference for ZWNBSP (zero-width no-break space) in HTML, but it, like any Unicode character, can be expressed using a character reference: 
(or, equivalently, 
). However, it is ineffective for keeping images in the same line. Images are not characters, and browsers are not required to implement Unicode semantics for ZWNBSP even when used between characters. The same applies to WORD JOINER, U+2060.
The most effective way is to wrap the img
tags in a nobr
element: <nobr><img ...><img ...></nobr>
. While not part of any HTML specification, and mentioned in HTML5 drafts as “obsolete”, this method works across browsers. If you would rather do things in a clumsier way that does not work when CSS is disabled, you can use an artificial wrapper element and set white-space: nowrap
on it.
@jthill, ‍ denotes ZERO WIDTH JOINER U+200D, a different character, intended for requesting for cursive joining or ligature rendering. – Jukka K. Korpela Jun 4 '14 at 19:29 | | |||
|
Ah. Thank you for the correction. I'll go read up on ‌ too. – jthill Jun 4 '14 at 19:37 |
这篇关于Zero-width non-breaking space的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!
‍
, since at least 2001 – jthill Jun 4 '14 at 18:20