HTML Tag to Go to a Location on a Page?

Discussion in 'HTML & Website Design' started by swoop, May 1, 2009.

  1. #1
    Can someone remind me how to tag a location somewhere on a page, so that a link like "http://mysite.com/index.html#location" will work?

    Thank you.
     
    swoop, May 1, 2009 IP
  2. ahsan_ma07

    ahsan_ma07 Peon

    Messages:
    97
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You don't need to include the whole link. Just include the id of the place where you want to go. Link with an href="#location" might do the trick.
     
    ahsan_ma07, May 1, 2009 IP
  3. nihangshah

    nihangshah Prominent Member

    Messages:
    5,536
    Likes Received:
    271
    Best Answers:
    3
    Trophy Points:
    395
  4. swoop

    swoop Active Member

    Messages:
    469
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    90
    #4
    swoop, May 1, 2009 IP
  5. Masterful

    Masterful Well-Known Member

    Messages:
    1,653
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #5
    Give the location you want to link to an ID. Then, use the ID in the anchor element.

    For example:

    <a href="#go">See Explanation</a>
    
    <div id="go">Explanation</div>
    Code (markup):
    Or, you can use the name attribute:

    <a href="#go">See Explanation</a>
    
    <a name="go">Explanation</div>
    Code (markup):
     
    Masterful, May 1, 2009 IP
  6. gummyworms

    gummyworms Active Member

    Messages:
    126
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #6
    for <a name="go">Explanation</div> it should be </a>
     
    gummyworms, May 2, 2009 IP
  7. CrazyJugglerDrummer

    CrazyJugglerDrummer Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Use both the name and id attributes for backward and forward compatibility. :D
     
    CrazyJugglerDrummer, May 3, 2009 IP
  8. Shirley1874

    Shirley1874 Peon

    Messages:
    558
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #8
    <a href="someURL/#anchorName">Head</a>
    <a name="anchorName">anchor of Head</a>
    
    HTML:
    pay attention "#" is very important, and "anchorName" is the name of the anchor text.
     
    Shirley1874, May 7, 2009 IP