开发者

Zero width word joiner and CSS generated content

I want to disallow line breaks in some places in a web page (eg. it's really ugly when the browser breaks the text "100 km/h" on two lines - in this question I'm concerned about breaking near the "/"). I tried this approach and it works

x&zwj;/&zwj;y <!-- x/y on one line -->

The entity &zwj; is a zero-width word joiner, similar to &nbsp;, but without space.

However开发者_如何学JAVA, I am concerned about a slightly more complex example:

x&zwj;/<span class="someclass"></span>

with style:

.someclass { content: "y"; }

This seems to work in Firefox (no linebreaks between normal and generated content), but in Opera, it fails. Should this work according to the standards?


Set white-space: nowrap; as seen here: webdesignerwall.com


Simply setting the br element to display none worked for me on Chrome. I'm not sure about FF, IE, and the like, but it shouldn't be too hard to check!

.someclass br { display: none; }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜