anchor "names" in empty table cells

J

James Mercola

Hi...\

one inconsistency I've noticed, is that when placing "named anchors" ( <a
name="anchorname"> ) on a page for people to navigate very quickly on long
pages, that depending on where I place the tag, it may not work.

example: i placed a tag in an empty table cell. it didn't work. I added a
non-breaking space to the table cell. It worked.

is there any guide anywhere as to where to, and where not to, place anchor
tags?

(using IE6 BTW)

thanks for any pointers...

JM
 
S

Sam Hughes


Hello - -\/kkj:-0-
one inconsistency I've noticed, is that when placing "named anchors"
( <a name="anchorname"> ) on a page for people to navigate very
quickly on long pages, that depending on where I place the tag, it may
not work.

I'll assume you included a closing tag of </a>.

no? Alas said:
example: i placed a tag in an empty table cell. it didn't work. I
added a non-breaking space to the table cell. It worked.

is there any guide anywhere as to where to, and where not to, place
anchor tags?

It's always good (and logical) to have some text within the anchor. Then
you cannot go wrong.

I.e. said:
(using IE6 BTW)

Well I'm not.
 
J

James Mercola

Well, hey Sam, "37 Helen's Can't Be Wrong!"

yes,the closing <a> is not an issue.
no, i don't want hyperlinked text as part of the anchor. the anchor is
simply a "destination" that people get to on a long page. Say you have
referenced footnotes at the bottom of a long article. And a link at the top
for "references"

<a href="#references">

Then, down almost at the point where the footnotes start, I place the
"destination" anchor tag

<a name="references"></a>

I've just noticed that browsers (at least ie6) is finnicky and won't use
these links if the "destination" anchor is placed - for instance - in an
empty table cell.

Hopefully this clarifies the situation somewhat.

JM
 
A

Anders Thorsen Holm

James Mercola said:
no, i don't want hyperlinked text as part of the anchor. the
anchor is simply a "destination" that people get to on a long
page.

Then why not settle for the id-attribute? Just give the cell, text,
image or whatever in question the relevant id:

<a href="#foo">Go to foo</a>
....
<h1 id="foo">This is the header for foo</h1>

Of course this won't work in Netscape 4.x, but who cares about that
virtual fossil anyway?
 
S

Sam Hughes

By the way, this newsgroup's convention is bottom posting.
Resistance is futile. Prepare to be assimilated.
Well, hey Sam, "37 Helen's Can't Be Wrong!"

What are you typing about?
yes,the closing <a> is not an issue.
no, i don't want hyperlinked text as part of the anchor.

Why not. You're being dogmatic. The HTML 4.01 Specification makes a
small word of warning about browser behavior:

Note. User agents should be able to find anchors created by empty A
elements, but some fail to do so. For example, some user agents may
not find the "empty-anchor" in the following HTML fragment:

<A name="empty-anchor"></A>
<EM>...some HTML...</EM>
<A href="#empty-anchor">Link to empty anchor</A>

I do not think IE has this problem, but it is one good reason to include
text within named anchors.
the anchor
is simply a "destination" that people get to on a long page.

Yes. For instance, if I have <h2><a name="blegh">His Bleghiness</a>
then the destination is the text of the level-two heading said:
[snip superfluity]
 
S

Sam Hughes

<a href="#foo">Go to foo</a>
...
<h1 id="foo">This is the header for foo</h1>

Of course this won't work in Netscape 4.x, but who cares about that
virtual fossil anyway?

Why deliberately introduce a solution that unnecessarily breaks older
browsers when a simple, ubiquitous alternative is available?
 
J

James Mercola

Of course this won't work in Netscape 4.x, but who cares about that
virtual fossil anyway?

Anders, I'm in total agreement with you. Let them eat cake. I'm a bit of a
rebel at heart, but I will take Sam's advice and post at the bottom of the
topic, just so I don't ruin his rum & coke.

By the way Sam, to get the "37 Helens" thing, (1) you have to be Canadian,
and (2) you have to be familiar with "The Kids In The Hall". It's kind of a
private serendipitous pun for Canucks who might be lurking amongst the
bullrushes.

Aside from that, whatever raises the fur on your browser is agreeable to me.

JM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top