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.
posted by Busoni to Technology (5 answers total) 3 users marked this as a favorite
Best answer: <span style="white-space: nowrap;">R&mdash;&mdash;</span>

That should work.
posted by DrJohnEvans at 7:38 AM on June 5, 2009

Best answer: You could also put a zero-width non-breaking space in between the dashes: &#xFEFF;
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 &thinsp; 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

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

« Older What's with the little poops?   |   what makes you think someone is attracted to you? Newer »
This thread is closed to new comments.