473,910 Members | 4,512 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

non-breaking hyphen

Hi. I found the following when trying to learn if there is such a thing as a
non-breaking hyphen. Apparently Unicode has a ‑ but that is not
well-supported, especially in older browsers. Somebody somewhere said:

Alternately, you can use CSS to declare a class having:

..nowrap { white-space:nowrap }

.... and then wrap the compound word in a <span class=nowrap></span> tag (or
any other suitable inline tag). You can also try { white-space:pre } ...

I wasn't sure where to post this, because part of the question is about the
character entity that apparently is NOT defined in html? However, what about
the CSS idea for non-wrapping? On one of my pages
www.TheBicyclingGuitarist.net/newstuff.htm I give credit to some folks at
comp.infosystem s.www.authoring.site-design. I want the hyphen in between
site and design to be a non-breaking one.

Chris Watson a.k.a. "The Bicycling Guitarist"

Jul 23 '05 #1
27 31448
On Fri, 12 Nov 2004 18:19:08 GMT, The Bicycling Guitarist
<Ch***@TheBicyc lingGuitarist.n et> wrote:
Hi. I found the following when trying to learn if there is such a thing
as a
non-breaking hyphen. Apparently Unicode has a ‑ but that is not
well-supported, especially in older browsers. Somebody somewhere said:

Alternately, you can use CSS to declare a class having:

.nowrap { white-space:nowrap }


You can do that. There are other solutions. I use <nobr>the stuff that has
to stay in one line</nobr>. Sure, the W3C-validator keeps warning that
<nobr> is not a valid element in HTML4.01. If you get bugged by this
nagging by the validator, just write your own DTD. I did. The validator is
very nice to me now ;-) .

--
PretLetters <http://home.wanadoo.nl/b.de.zoete/>
Webontwerp <http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html >
Zweefvliegen <http://home.wanadoo.nl/b.de.zoete/html/vliegen.html>
DTD <http://home.wanadoo.nl/b.de.zoete/dtd/not_so_strict.d td>
Jul 23 '05 #2
On Fri, 12 Nov 2004 18:19:08 GMT, "The Bicycling Guitarist"
<Ch***@TheBicyc lingGuitarist.n et> wrote:
Hi. I found the following when trying to learn if there is such a thing as a
non-breaking hyphen. Apparently Unicode has a ‑ but that is not
well-supported, especially in older browsers. Somebody somewhere said:

Alternately, you can use CSS to declare a class having:

.nowrap { white-space:nowrap }

... and then wrap the compound word in a <span class=nowrap></span> tag (or
any other suitable inline tag). You can also try { white-space:pre } ...

I wasn't sure where to post this, because part of the question is about the
character entity that apparently is NOT defined in html? However, what about
the CSS idea for non-wrapping? On one of my pages
www.TheBicyclingGuitarist.net/newstuff.htm I give credit to some folks at
comp.infosyste ms.www.authoring.site-design. I want the hyphen in between
site and design to be a non-breaking one.


Using CSS white-space:nowrap seems to work well in browsers that are at
all recent. There is however a small confusion factor: the CSS2 spec
says that white-space only applies to block-level elements. For
white-space:pre this is sensible, for white-space:nowrap it is stupid.
But the browser writers seem to have decided to ignore that line of the
spec and do something sensible. (AFAIK)

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 23 '05 #3
Stephen Poley <sb************ ******@xs4all.n l> wrote:
Using CSS white-space:nowrap seems to work well in browsers that are at
all recent.
Yes, when CSS is enabled.
There is however a small confusion factor: the CSS2 spec
says that white-space only applies to block-level elements.


It has long been said that this was a mistake and they probably didn't
mean to say so. But due to the processes of the W3C, the W3C
recommendation is currently the CSS2 spec but the W3C really _means_ that
everyone should use the CSS 2.1 draft ("Proposed Recommendation" ).

The wording of the meaning of the property is vague too, especially if
you think about the name white-space. Hyphens aren't white space of
course.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 23 '05 #4
"The Bicycling Guitarist" <Ch***@TheBicyc lingGuitarist.n et> wrote:
- - part of the question is
about the character entity that apparently is NOT defined in html?


The construct ‑ is certainly defined in HTML, as denoting the
character NON-BREAKING HYPHEN U+2011. (It's not a character entity but a
character reference. The terminology seems to be permanently confused,
though.)

But the HTML specifications are very vague about the required processing
of characters. Surely U+2011 has definite semantics in Unicode, but are
HTML user agents required to observe all the semantics of Unicode
characters? The HTML specifications says, oddly:
"In HTML, there are two types of hyphens: the plain hyphen and the soft
hyphen."
http://www.w3.org/TR/html4/struct/text.html#hyphenation

Later it specifies that "plain hyphen" means U+002D, or the well-known
"Ascii hyphen", or HYPHEN-MINUS to use the Unicode name. This character
has, by Unicode definition, ambiguous semantics, as its official Unicode
name suggests.

So apparently the real hyphen, HYPHEN U+2010, is _not_ a hyphen in HTML,
and neither is the non-breaking hyphen. Right? Or maybe not. Maybe the
people who wrote the HTML specification simply didn't think much about
character semantics in general. They just wrote a short, sketchy, and
misleading description that revolves around the soft hyphen (and mentions
"plain hyphen" just for contrast).

Hence, the fact that few browsers support the non-breaking hyphen cannot
really be regarded as bug. Moreover, it's basically a _font_ issue. To
satisfy minimal requirements in processing (as far as rendering HTML
documents goes), a browser simply has to display the character, treating
it as a normal graphic character (as opposite to its eventual treatment
of "plain hyphen" as allowing a line break after it).

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 23 '05 #5
On Fri, 12 Nov 2004, Jukka K. Korpela wrote:
The construct ‑ is certainly defined in HTML, as denoting the
character NON-BREAKING HYPHEN U+2011. (It's not a character entity
but a character reference. The terminology seems to be permanently
confused, though.)
You noticed that too...
But the HTML specifications are very vague about the required
processing of characters. Surely U+2011 has definite semantics in
Unicode, but are HTML user agents required to observe all the
semantics of Unicode characters?
I think the answer to that is "not entirely". There are some Unicode
rules that are intended to be effective in plain text, but don't have
any obvious applicability in the source "code" for a markup language,
for example.
The HTML specifications says, oddly:
"In HTML, there are two types of hyphens: the plain hyphen and the soft
hyphen."
http://www.w3.org/TR/html4/struct/text.html#hyphenation
This goes right back to RFC1866, doesn't it? And has not been taken
seriously by browser implementers.
Later it specifies that "plain hyphen" means U+002D, or the well-known
"Ascii hyphen", or HYPHEN-MINUS to use the Unicode name. This character
has, by Unicode definition, ambiguous semantics, as its official Unicode
name suggests.
RFC2070 referred to iso-10646 rather than Unicode as such, but
developments have really made that distinction rather irrelevant. At
least, we might hope that they have.
So apparently the real hyphen, HYPHEN U+2010, is _not_ a hyphen in HTML,
and neither is the non-breaking hyphen. Right? Or maybe not. Maybe the
people who wrote the HTML specification simply didn't think much about
character semantics in general.
You could put it that way...
Hence, the fact that few browsers support the non-breaking hyphen
cannot really be regarded as bug.


And, conversely, that authors cannot really *rely* on browser
behaviour in this regard.

Jul 23 '05 #6
Alan J. Flavell (fl*****@ph.gla .ac.uk) wrote:
: On Fri, 12 Nov 2004, Jukka K. Korpela wrote:

: > The construct ‑ is certainly defined in HTML, as denoting the
: > character NON-BREAKING HYPHEN U+2011. (It's not a character entity
: > but a character reference. The terminology seems to be permanently
: > confused, though.)

: You noticed that too...

: > But the HTML specifications are very vague about the required
: > processing of characters. Surely U+2011 has definite semantics in
: > Unicode, but are HTML user agents required to observe all the
: > semantics of Unicode characters?

: I think the answer to that is "not entirely". There are some Unicode
: rules that are intended to be effective in plain text, but don't have
: any obvious applicability in the source "code" for a markup language,
: for example.

Surely they don't have any applicability in any text except as the
application chooses them to have applicability.

If you use vi to create a unicode readme file that contains arabic
characters then would a programmer cat'ing the file to the console expect
to see the arabic going left to right or right to left? (Assuming the
console knew how to handle the character-encoding/character-set in the
first place).

If an html file containing mostly english text includes a paragraph that
uses characters in the range U+0600 through U+06FF (arabic) then should
the browser be "smart enough" to display this right to left?

Somehow, having the browser recognize different characters as being
different kinds of hyphens and therefore formatting the text differently,
instead of requiring markup to tell it what to do, seems wrong to me but
that's just my spur of the moment $0.02 worth.

Jul 23 '05 #7
Barbara de Zoete wrote:
There are other solutions. I use <nobr>the stuff that
has to stay in one line</nobr>. Sure, the W3C-validator keeps warning
that <nobr> is not a valid element in HTML4.01. If you get bugged by
this nagging by the validator, just write your own DTD. I did. The
validator is very nice to me now ;-).


You should *never* use <nobr> under any circumstances in HTML, even if
you write your own DTD. It is a presentational element, and thus has no
place in HTML. It is also a proprietary element created by either
Netscape or IE (I can't remember which), which makes it even worse.

You should use semantic class names that represent what the content is,
not how it looks. When writing markup, you have to think about *why*
the content needs to have no breaks, or other presentational features,
not what it looks like. For example, from The Bicycling Guitarist's
page, where (s)he would like the it to not wrap, in the following:

comp.infosystem s.www.authoring.site-design

Usually, I would recommend using the U+2011 (‑, &#x2011; or ‑),
though apparently support in older browsers is an issue, but more
importantly, because it is the name of a news group which uses a
HYPHEN-MINUS, and that name needs to be understood if it were copied and
pasted into a news reader. Thus, the use of a non-breaking hyphen is
actually incorrect. I tested this, and wrote that newsgroup using a
non-breaking hyphen, and then copied to my newsreader. The group could
not be found, but once I chaged it back to a regular hyphen it worked.

Therefore, in this case, it appears that the use of a non-breaking
hyphen is infact presentational, not semantic, so I would markup that up
like this:

<a href="news:comp .infosystems.ww w.authoring.sit e-design"
class="news">co mp.infosystems. www.authoring.s ite-design</a>

That has the advantage of also providing a link that a user can use to
subscribe to the newsgroup.

Because it is also code that can be used by a news reader to subscribe
to that newsgroup, then you could also markup it up in <code>, or even
<kbd> depending on the context, but <kbd> would only be appropriate if
you were telling a reader to enter the text into their newsreader. In
this case, <code> seems most approprate.

<code class="news">co mp.infosystems. www.authoring.s ite-design</code>

If you like, you can also combine both the link and <code>, but only one
needs to have the class="news".

Finally, just apply the style to .news { ... }

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://SpreadFirefox.com/ Igniting the Web
Jul 23 '05 #8
On Sat, 13 Nov 2004 03:04:59 GMT, Lachlan Hunt <sp***********@ gmail.com>
wrote:
Barbara de Zoete wrote:
There are other solutions. I use <nobr>the stuff that has to stay in
one line</nobr>. Sure, the W3C-validator keeps warning that <nobr> is
not a valid element in HTML4.01. If you get bugged by this nagging by
the validator, just write your own DTD. I did. The validator is very
nice to me now ;-).


You should *never* use <nobr> under any circumstances in HTML, even if
you write your own DTD. It is a presentational element, and thus has no
place in HTML. It is also a proprietary element created by either
Netscape or IE (I can't remember which), which makes it even worse.

You should use semantic class names that represent what the content is,
not how it looks.


I know and I don't give a damn. Sometimes one can take it too far. <nobr>
Is short, easy to remember. I see no reason not to use it. No, anyone
telling me it is presentational and or a proprietary element is not a
reason either.
Sometimes I just go with wat is practical. <nobr> or <span
class="nobreak" >? I prefer the first. I hate CSS-soup as much as I hate
tag-soup.

--
PretLetters <http://home.wanadoo.nl/b.de.zoete/>
Webontwerp <http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html >
Zweefvliegen <http://home.wanadoo.nl/b.de.zoete/html/vliegen.html>
DTD <http://home.wanadoo.nl/b.de.zoete/dtd/not_so_strict.d td>
Jul 23 '05 #9
Barbara de Zoete wrote:
On Sat, 13 Nov 2004 03:04:59 GMT, Lachlan Hunt
<sp***********@ gmail.com> wrote:
You should *never* use <nobr> under any circumstances in HTML

You should use semantic class names that represent what the content
is, not how it looks.
I know and I don't give a damn.


Well, keep your bad habbits to yourself. Don't advise anyone else to
use them.
Sometimes one can take it too far.
<nobr> Is short, easy to remember. I see no reason not to use it. No,
anyone telling me it is presentational and or a proprietary element is
not a reason either.
Sometimes I just go with wat is practical. <nobr> or <span
class="nobreak" >? I prefer the first.
class="nobreak" is just as bad as <nobr> in my opinion, it says nothing
about *why* it is being styled like that. The only difference is that
at least the span is valid, so I would always choose that over nobr, but
since they're rarely, if ever, the only options, I would always use
something more semantic.
I hate CSS-soup as much as I hate tag-soup.


Using <nobr> is tag soup, so that's just being hypocritical. Although
I've never heard of CSS-soup before, but I'm guessing, if you didn't
just make it up, that it would refer to CSS filled with presentational
class names and IDs (Which I've seen plenty of), rather than styles for
semantic elements, classes and IDs, which is i how stylesheets should be
done.

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://SpreadFirefox.com/ Igniting the Web
Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3769
by: klaus triendl | last post by:
hi, recently i discovered a memory leak in our code; after some investigation i could reduce it to the following problem: return objects of functions are handled as temporary objects, hence their dtor is called immediately and not at the end of the function. to be able to use return objects (to avoid copying) i often assign them to a const reference. now, casting a const return object from a function to a non-const reference to this...
3
12298
by: Mario | last post by:
Hello, I couldn't find a solution to the following problem (tried google and dejanews), maybe I'm using the wrong keywords? Is there a way to open a file (a linux fifo pipe actually) in nonblocking mode in c++? I did something ugly like --- c/c++ mixture --- mkfifo( "testpipe", 777);
25
7723
by: Yves Glodt | last post by:
Hello, if I do this: for row in sqlsth: ________pkcolumns.append(row.strip()) ________etc without a prior:
32
4547
by: Adrian Herscu | last post by:
Hi all, In which circumstances it is appropriate to declare methods as non-virtual? Thanx, Adrian.
8
3530
by: Bern McCarty | last post by:
Is it at all possible to leverage mixed-mode assemblies from AppDomains other than the default AppDomain? Is there any means at all of doing this? Mixed-mode is incredibly convenient, but if I cannot load/unload/reload extensions into my large and slow-to-load application during development without restarting the process then the disadvantages may outweigh the advantages. I've got a mixed-mode program in which I create a new AppDomain...
14
8513
by: Patrick Kowalzick | last post by:
Dear all, I have an existing piece of code with a struct with some PODs. struct A { int x; int y; };
11
3480
by: ypjofficial | last post by:
Hello All, So far I have been reading that in case of a polymorphic class ( having at least one virtual function in it), the virtual function call get resolved at run time and during that the vtable pointer is made use of.. eg. class one {
2
6143
by: Ian825 | last post by:
I need help writing a function for a program that is based upon the various operations of a matrix and I keep getting a "non-aggregate type" error. My guess is that I need to dereference my pointers, but I'm not sure. Please help. The code: void equate(matrix *A, matrix *B) { int i, j; assert(A.row_dim == B.col_dim && A.col_dim == B.col_dim); for(i=0; i < A.row_dim; i++) for(j=0; j < A.col_dim; j++)
0
2355
by: amitvps | last post by:
Secure Socket Layer is very important and useful for any web application but it brings some problems too with itself. Handling navigation between secure and non-secure pages is one of the cumbersome jobs. When a non-secure page references a secure page with relative URL, the web server generates error until absolute URL with https prefix is used. On the other hand when a secure page references a non-secure page, the non-secure page will be...
399
13154
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post by:
PEP 1 specifies that PEP authors need to collect feedback from the community. As the author of PEP 3131, I'd like to encourage comments to the PEP included below, either here (comp.lang.python), or to python-3000@python.org In summary, this PEP proposes to allow non-ASCII letters as identifiers in Python. If the PEP is accepted, the following identifiers would also become valid as class, function, or variable names: Löffelstiel,...
0
9879
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11349
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10921
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11055
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10541
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9727
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7250
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5939
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3360
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.