Search code examples
htmlhyperlinkpositionanchor

Anchor link landing in wrong position


Probably a stupid question, but I honestly can't wrap my head around what's going wrong here.

http://harrisonfjord.com/thinkinc/

A site I'm building at the moment. I want to make an anchor link at http://harrisonfjord.com/thinkinc/index.php#sponsors. I've set up the anchor to occur just before in the following code:

<a name="sponsors"></a>
    <div class="sponsors">
        <div class="sponsors-left">
            <h2>Sponsors</h2>
                <p>Support the lovely folks who support us! Visit their websites, join their mailing lists and peruse their wares. They are all highly-deserving of your custom, and we're thrilled to have each and everyone one of them on-board!</p>
            </div>

However, when you click on the anchor link it lands about halfway down the div. I thought it might have been a problem with the images loading after the anchor link loads, so I manually put in widths/heights for all of the tags. I also did the same for the cufon text replacement in the title bar.

None of that helped, so now I turn to you. The anchor is also not working in Firefox, for whatever reason. Any thoughts on what I've done wrong here?

Cheers!


Solution

  • I think the problem is resulting from the anchors with no contents that you are using.

    Also, it appears that name= has been deprecated in favor of id= as a fragment identifier in certain elements (including A) which makes a kind of sense as ID attributes are unique whereas NAME attributes are not so guaranteed.

    I'd try sticking the fragment identifier in the actual renderable entity such as:

    <h2 id="sponsors">Sponsors</h2>
    

    and see where that gets you. Incidentally, it looks like a good conference, I hope you get a comp admission.