Non-breaking 2-em dash
June 5, 2009 7:26 AM Subscribe
How can I use non-breaking 2-em dashes using HTML or CSS?
For example, I'd like to write "R——" and not have that broken up by a line.
It seems I could use the "nobr" tag, although it appears it's not encouraged.
I've been led to believe the 2-em dash is precisely that: two em-dashes. Unless there's a single character I could use?
I should mention I'm just beginning to learn CSS, so if the answer is obvious, my most humble apologies.
For example, I'd like to write "R——" and not have that broken up by a line.
It seems I could use the "nobr" tag, although it appears it's not encouraged.
I've been led to believe the 2-em dash is precisely that: two em-dashes. Unless there's a single character I could use?
I should mention I'm just beginning to learn CSS, so if the answer is obvious, my most humble apologies.
Best answer: You could also put a zero-width non-breaking space in between the dashes: 
posted by XMLicious at 8:14 AM on June 5, 2009
posted by XMLicious at 8:14 AM on June 5, 2009
The non-breaking space character (&mbsp;) works how you want it to, but it's awful wide: R— —
There are thinner spaces (for example   gives you R— —) that you could combine with nowrap maybe?
posted by davextreme at 8:21 AM on June 5, 2009
There are thinner spaces (for example   gives you R— —) that you could combine with nowrap maybe?
posted by davextreme at 8:21 AM on June 5, 2009
You can also tweak the CSS letter-spacing property to fine-tune the space between the dashes in DJE's span tag. Admittedly, that won't work in all browsers, but it's another option.
posted by yerfatma at 8:26 AM on June 5, 2009
posted by yerfatma at 8:26 AM on June 5, 2009
Best answer: It seems I could use the "nobr" tag, although it appears it's not encouraged
It might not be encouraged, but for now nothing is as widely supported as NOBR.
posted by Civil_Disobedient at 9:18 AM on June 5, 2009
It might not be encouraged, but for now nothing is as widely supported as NOBR.
posted by Civil_Disobedient at 9:18 AM on June 5, 2009
This thread is closed to new comments.
<span style="white-space: nowrap;">R——</span>
That should work.
posted by DrJohnEvans at 7:38 AM on June 5, 2009