Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-breaking parentheses?

In the footer of a flexible-layout website I've noticed that IE tends to line-wrap on parenthesis characters (in a phone number in this case). Is there a visually equivalent non-breaking parenthesis, in a similar vein to non-breaking spaces and non-breaking hyphens, that I can use instead?

like image 547
graphicdivine Avatar asked Apr 26 '10 10:04

graphicdivine


3 Answers

Try this:

.phone{
    white-space: nowrap;
}

<p>Call Customer Support at <span class="phone">+34 (947) 12 34 56 78</span> for further enquiries.</p>

You can do many other things (from <nobr> tag to certain Unicode chars) but they aren't as cross-browser as this.

like image 147
Álvaro González Avatar answered Sep 29 '22 21:09

Álvaro González


I ran into this issue with a plural treatment like "user(s)" where IE breaks the word after the R. You should be able to use the word joiner character (&#x2060;), but in my test with IE11, only the deprecated zero-width non-breaking space character worked:

user&#xFEFF;(s)
like image 44
Wes Reimer Avatar answered Sep 29 '22 19:09

Wes Reimer


I have had the same problem; here is a solution which worked:

The number to call is: (423)&nbsp;276&mdash;0000

According to the Unicode Standard (specifically, UAX #14), a line break is not permitted before or after a no-break space. Therefore, the &nbsp; prevents the browser from line-breaking on the parentheses. In either case, it doesn't hurt to have a space between the area code and the phone number.

like image 36
Alex Avatar answered Sep 29 '22 20:09

Alex