Link to specific part of page

I’ve tried all of the following:

<a name="test"></a>
<a id="test"></a>
<h4 id="test">SOME TEXT</h4>

And then linking to them like this:

Read More
<a href="pagename#test">

All of the above work with Firefox, IE and Chrome, but none of them worked with Safari 5.xx on a mac. Any help is very much appreciated.

Related posts

Leave a Reply

2 comments

  1. <a href="#test">Go to Test</a>

    .
    .
    .

    <div id="test">This is Test.</div>

    This should work.

    EDITED:
    Also, if you want to link to a particular id in a different page, which I think you do, use:

    <a href="somepage.html#test">Go to Test on some different page.</a>

  2. Looks like you have a misunderstanding of how anchors work, you need to use the href attribute.

    <a name="test"></a>          <!-- not required -->
    <a id="test"></a>            <!-- not required -->
    <h4 id="test">SOME TEXT</h4> <!-- this is correct -->
    

    To link to the <h4 id="test"> element do this (if target on the same page):

    <a href="#test">Go to Test</a>
    

    If target on a different page:

    <a href="other_page.html#test">