Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 925
JVG Avatar asked Jul 26 '11 07:07

JVG


People also ask

How do you change an anchor position?

Click on the object anchor icon and drag it either up (towards the beginning of the document) or down (towards the end of the document). Release the mouse button when the mouse pointer is next to the paragraph where you want the object anchored.

Can you redirect an anchor link?

One can use the anchor tag to redirect to a particular section on the same page. You need to add ” id attribute” to the section you want to show and use the same id in href attribute with “#” in the anchor tag.

Why you shouldn't use anchor links in your emails?

Since anchor links don't work on mobile devices, learn about the different ways to display that information to your contacts. [Duration: 2:28] Anchor links are an outdated email marketing feature that don't work when viewing emails on a mobile device.

Where do you put the anchor link?

In the content editor, highlight the text you want to hyperlink. In the rich text toolbar, click the linkd link icon. If the anchor you're linking to is on the same page as your link: In the pop-up box, click the Link to dropdown menu and select Anchor on this page.


1 Answers

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.

like image 192
msw Avatar answered Oct 06 '22 23:10

msw