Why does <a> work the way it does

I’m trying to remember why this works the way it does.

I have a header call:

bus_list.php#form_a52

When it loads, the page automatically scrolls down to anchor:

<a name="form_a52"></a>

Why is that?

I have forgotten and haven’t be able to google the answer.

There is an element on bus_list.php with id=“form_a52”. That’s why that page (when loaded) jumps down.

Edit (since you edited): name=“” is outdated though. It should be id="form_52. The name attribute will work, but it should be ID nowadays.

Thank-you.

Do you have reference for that? Or suggest what to google?

I wasn’t able to find a ref.

You could try Googling “fragment identifier” or “named anchor”.

http://www.w3.org/TR/html401/struct/links.html

1 Like

Not all browsers support it whereas all browsers more recent than Netscape 4 support id. The name attribute on an <a> tag was only ever needed for Netscape 3 and 4.

Relevance? Netscape 4 was superseded in 2000 by Netscape 6. Do you know anyone who still uses Netscape 3/4 as their primary web browser?

It was working for OP so I admitted that yes it DOES work…however as I mentioned, that’s not what should be used in this day and age (ID should.)

Pro tip. Since the link goes to the ID attribute you no longer need the A tag as anchor.

So <h3 id="form_a52"> I used to be an anchor</h3> works just as well

1 Like

Exactly my point - <a name=""> became irrelevant once Netscape 4 died. Since then an id on any tag at all has replaced it.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.