I can find nothing wrong with my syntax, yet instead of sending me to the section, it sends me all the way to the bottom of the page. Here’s how I’m attempting to call the link:
<a href="URL#anchor_name">Link to Anchor</a>
How do I get the link to direct to “section_content” and not to the bottom of the page? I’ve tried placing the anchor inside the “clear” div, inside the “section” div, and no results, It still keeps sending me to the bottom.
I don’t know if this was your original issue…BUT…if you are linking from an external page you will need the URL AND the anchor in the HREF attribute of the A tag. Right now it doesn’t appear you have that. So your current links are looking for an id in the same page they are on rather than your target page.
I’m beginning to see it work sometimes, but not always. Is it possibly that my version of Firefox is corrupt?
As for the duplicate IDs, I see them, but none of them are part of any hyperlinks so I’m not particularly worried. It’s the ID’s I’m trying to link to that concern me, and the worst I’ve been able to find is attempting to link to another anchor by the same ID on another page.
Suppose you have an item on your page with an id of “example”. It could be anything; for argument’s sake, I’ll use an <h2>. You can set up a link from anywhere within that page to jump directly to that h2. Like this:
<h2 id="example">This is an article about an example</h2>
and then elsewhere
<a href="#example">Link to article about example</a>.
If you want to link to it from a different page, then you would need to include the target page in the URL.
<a href="article.html#example>Link to article about example</a>
You’re right, I’m very confused… yet everything worked fine until I converted to HTML5. Then all of a sudden my hyperlinks started directing to the wrong part of the page (usually the bottom).
As @SamA74 advised, you should run your pages through the validator, because you do have a lot of errors. Most of them are nothing to do with your current issue, but they do need fixed - if only to help you see tell the wood from the trees.
Then check that your links are all set up correctly.
Converting to html5 is more than just changing the doctype declaration. The pages are full of attributes that are obsolete in html5.
See above link to the validator.
Using the full URL also seems to have helped… as opposed to just:
<a href="store_best_of.html#BCpart2">
Once I stick the web address in front, my browser seems less confused, but in the end I had to change some of my styles too (as I mentioned to TechnoBear). In the end, I think it was the “clear” div that was confusing my browser. Once I changed “clear” from an ID to a class style, that seemed to clear it up (no pun intended).
That code was only needed to support both Netscape 4 (which needed the <a name="anchor_name" and more modern browsers that just need the id="anchor_name" - unless you still need to support Netscape 4 you can just use any id already in the page as the destination.