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‍/‍y <!-- x/y on one line -->
The entity ‍
is a zero-width word joiner, similar to
, but without space.
However开发者_如何学JAVA, I am concerned about a slightly more complex example:
x‍/<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; }
精彩评论