A 'non-breaking dash' please?

Thursday, 16 Oct 2008
Yesterday I got myself in a fight with a minus -. Browsers will regard a minus as an excellent opportunity to softbreak your content. So guess what happens if you want to squeeze a negative number (say -19,95) in a small table cell? It appears as
-
19,95
which is obviously not what was intended. We all know about the non-breaking space  , so I started to wonder: "Is there also a non-breaking dash?". Turns out I was actually looking for the "non-breaking hyphen":
‑
A universe of wonderful online typographic possibilites was revealed to me by this great article from A list Apart. It's a much bookmarked article, and I understand why: there is just a truly miraculous amount of alternatives for our common dashes, spaces and quotes.
Posted in: webdesign typography
Add comment

Comments (4)

05-05-2010, 14:50
Philipp
CSS:

td.cellThatWontSoftbrakeMyContent{
white-space:nowrap;
}

doesnt work ?
08-02-2011, 10:37
Rickard Sundin
I just learned this:

–

Useful when writing an interval, e.g. "It will be done in 2–3 weeks".
04-04-2011, 14:38
Monkey
white-space:nowrap; will not work if you DO want multiline contents, but just don't want the dash to break off.
09-07-2011, 19:47
Ted Pavlic
A hyphen is a terrible replacement for a dash. I don't know of an HTML entity for a non-breaking dash, but I wish there was one.

In the meanwhile, you really should be doing as many other editors do (it's done all over Wikipedia). You surround your dashed expressions in HTML/CSS that forces them not to wrap. Check out things like:

http://en.wikipedia.org/wiki/Wikipedia:Line_break_handling

http://en.wikipedia.org/wiki/Template:Nowrap_begin

http://en.wikipedia.org/wiki/Template:Nowrap

For examples of non-wrapping/breaking implementations (made "simpler" through Wikimedia templates).