[WEB4LIB] Hard hyphen and HTML validation

Stacy Pober stacy.pober at manhattan.edu
Tue Oct 29 19:03:11 EST 2002


I knew the character validates as &

However...

The problem is Internet Explorer feels it's proper to do a 'line 
break' at a hyphen or & character if the line length works out
just right.  

For example, if IE sees that the line length is up, it will break
AFL-CIO
into:
AFL-
CIO

I'm doing a simple text menu.  The menu has with short one or 
two word links. One of the links is a relatively short hyphenated 
word. I don't want the browser to break that one word onto two
lines. I'm currently using the <nobr> html tag for this, and, while
it causes validation errors, it works okay for all the browsers I've
tried. 

I know there must be all kinds of interesting ways to do menus that
would get around this, but I don't want to do fancy stuff for this
particular 'horizontal menu' of links.  It's for a simple, 
low-graphics site and I would prefer that it display with reasonable
consistency in everything from v.3 browsers on up. 

I just want this one hyphenated word to stay on ONE line. 

Someone privately wrote to suggest using a style sheet for this: 

<span style="white-space:nowrap;">Haagen-Dazs</span>

I'm considering doing that, but I'm curious which browsers it 
will NOT work in. 

Thanks, 
Stacy

Robert Sullivan wrote:
> > OTOH, I probably shouldn't worry too much about those validation
> > errors.  I have come to the realization that some of our pages
> > will *always* produce coding errors because of ampersands or
> > other unusual characters that are a part of some of our database
> > URL's.
> 
> Actually, if you convert & to &amp; they validate properly.  (Thanks to
> Web4Lib for informing me of this.)
> 
> Bob Sullivan
> Schenectady County Public Library (NY)  <http://www.scpl.org>

-- 
Stacy Pober
Information Alchemist
Manhattan College Libraries
Riverdale, NY 10471
http://www.manhattan.edu/library/



More information about the Web4lib mailing list