Non-breaking Hyphen

I need to use a non-breaking hyphen in my html mark-up. It usually happens when I want to force a range of numbers in a table cell not to split onto two lines.

And the magic character is?

& #8209;

This is cross-browser compatible.

Note: There’s a much better way to keep lines from breaking than using a non-breaking hyphen. Use CSS instead:

<style type=”text/css”>
p.nobreak { white-space:nowrap;}
<p>This won’t break–honest</p>

Published in: on July 14, 2010 at 6:04 pm  Leave a Comment  

The URI to TrackBack this entry is:

RSS feed for comments on this post.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: