WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Anchor name adds a slash (9 posts)

  1. Yukon Cornelius
    Member
    Posted 1 year ago #

    Hi,

    I am trying to do what should be some the most basic html, but it's not working for me. Here is my code:

    <a name="rocket"></a>
    <div>
        <h3>The Title</h3>
        <p>some text</p>
    </div>

    I want to use the anchor name to fly down the contact page to the correct section.

    When I use a link within the contact page like this:

    <a href="#rocket">click here</a>

    it works fine. But i want to come from another page and then fly down. So I am using this:

    <a href="http://mysite.com/contact#rocket">click here</a>

    but it seems to add a slash after contact and redirect to http://mysite.com/contact/#rocket, which means that it stays at the top of the contact page instead of flying down.

    Does anyone know why this is happening? If you could point me in the right direction, I'd be grateful.

    Thanks,

    Yukon

  2. Andrew Bartel
    Member
    Posted 1 year ago #

    That should work fine, I even just checked one of my sites and it does add the slash but still "flies down". Can we see the site where it's not working?

  3. Yukon Cornelius
    Member
    Posted 1 year ago #

    Thanks for taking a look Andrew, here's the url:

    http://mshs.projects.gospacerace.com/contact/#steamships/

  4. Andrew Bartel
    Member
    Posted 1 year ago #

    Ah, I misunderstood, yes that last slash would cause it not to honor the anchor. I thought you meant the one in between contact and #. How/where is that link being generated?

  5. Media X
    Member
    Posted 1 year ago #

    It works but only without the slash at the end
    http://mshs.projects.gospacerace.com/contact/#steamships

  6. Yukon Cornelius
    Member
    Posted 1 year ago #

    hahahaha you hit the nail on the head.

    i was talking about the slash in between the contact and the hash, but i didn't realize the final slash made any difference. I removed that, and it's all good.

    Many thanks dude, I really appreciate your help!

  7. Yukon Cornelius
    Member
    Posted 1 year ago #

    I meant dudes, of course. Many thanks to you both.

    Yukon

  8. Andrew Bartel
    Member
    Posted 1 year ago #

    Sure thing.

  9. guitarguy0124
    Member
    Posted 4 months ago #

    I have followed all of the instructions and simply cannot get this to work...

    I've tried both of these as the link:

    http://nextgenerationmediation.com/about/#braveone
    http://nextgenerationmediation.com/about#braveone

    And then this is the html portion of the target anchor:

    <div id="bravone">
    <h5>Becoming A Brāv One</h5>
    </div>

    What am I doing wrong?

Topic Closed

This topic has been closed to new replies.

About this Topic