Ah, Sweet Mister ‘‑’ Of Life, At Last I’ve Found You!

Yes, Virginia, there IS a non-breaking hyphen, Unicode U+2011, or (in an HTML document)

&‍#x2011;

Unlike an ordinary hyphen, this one will not allow a browser-inserted line break immediately following it. This is easier with non-breaking spaces; you just use the entity name

 

in your HTML document, and the browser inserts it for you. But with hyphens, to prevent an untimely line break, you have to use the non-breaking hyphen character. There’s apparently no easy entity name for it; use the code above directly in the HTML, or copy-paste it as described below.

If you forget its Unicode character number, or if you’re not fond of messing with HTML, you can search your character map for “NON-BREAKING HYPHEN” and copy-paste what it finds. I have tested the resulting character in the current Firefox and Google Chrome browsers; it works in both.

Why, oh why is this not universally known? I’ve been looking for such a thing for several years, and only today did Google search turn up something useful.

ASIDE: if you try to copy and paste the code for the non-breaking hyphen above near the top of the post, you will find that when you paste it, it may or may not work, depending on the editor you’re working in… e.g., Linux folks will find it does not work in gedit, but works in the WordPress editor. That’s because there’s an additional invisible character in the above example between the & and the # known as a “zero-width joiner.” I had to insert it to overcome WordPress’s insistence on interpreting the ampersand‑”amp”‑semicolon as a literal ampersand in that context only. I do not know why it does that; I do not believe it is correct… but I had to insert the zero-width joiner to get WordPress to display the code properly. Your best bet is to type the code manually:

ampersand‑#‑x‑2011‑semicolon.

Be sure the ‘x’ is lower case.

Or just use the Character Map (same name in Windows and Linux) and forget about HTML.

Advertisements
Post a comment or leave a trackback: Trackback URL.

Comments

  • MandT  On Monday February 6, 2012 at 4:54 pm

    AAAHHHHHGGGG Our new Word Press site is driving me crazy, because I don’t seem to have much of a learning curve left.

    • Steve  On Monday February 6, 2012 at 5:21 pm

      MandT, I’ve found one ironclad rule in writing a WordPress post: do NOT attempt to create a BLOCKQUOTE in Visual mode! It fails as often as it works, and believe me, the fault is NOT the user’s! If you want a BLOCKQUOTE, click the HTML mode tab, manually insert the <BLOCKQUOTE> and </BLOCKQUOTE> tags at the beginning and end of the material quoted, and (if you wish) switch back to Visual mode.

      I find that I have fewer battles with WordPress if I simply stay in HTML mode except when I need to apply colors to text. Not everyone feels the same way, and it’s not really fair, because I made my living coding HTML in the early days of the Web. But it certainly avoids some of the more egregious shortcomings of the WordPress visual editor. Try it on a test post where you have nothing to lose; practice there until you feel confident you know the editor’s quirks.

Leave a Reply (NB: I'm not responsible for any ad!)

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: