I have a heading. At the end of the last word of the heading is an em dash (there is no white space between the word and the em dash).
When the browser window is made smaller the em dash breaks and goes on to a new line. Having an em dash on its own line is bad typography.
How do I stop the line breaking before the dash (so that the last word runs on to the new line)?
Here is the code:
<h1>XYZ consultancy is super great and brilliant—</h1>
I've tried wrapping the last word and the em dash in a span
with white-space: nowrap;
. It works on my computer, but I can't understand why this is the case as there is no white space and I'm concerned that it won't work on all browsers.
I can't use a non-breaking hyphen, because it needs to be an em dash and I don't think there is a non-breaking em dash.
Thanks