Zero-width non-breaking space

前端 未结 4 1075
孤独总比滥情好
孤独总比滥情好 2020-12-28 15:40

I have a piece of text and at the end I want to insert two icons.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt          


        
4条回答
  •  -上瘾入骨i
    2020-12-28 16:08

    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: . 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.

提交回复
热议问题