Linking to a particular section or part of a web page

Discussion in 'HTML & Website Design' started by coldnorth, Apr 24, 2010.

  1. #1
    How do I make a link to a certain section of a web page? For example, I have a glossary page on my site. I would like to link a word on another page to its definition on the glossary page and for it to land at that particular section even if the definition may fall in the middle or end of a page. I have seen this done but have no idea how. Anyone know how this is done?
     
    coldnorth, Apr 24, 2010 IP
  2. VarriaStudios

    VarriaStudios Member

    Messages:
    246
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #2
    <A NAME="Destination"> Destination </A>

    <A HREF="#Destination"> Destination </A>
     
    VarriaStudios, Apr 24, 2010 IP
  3. coldnorth

    coldnorth Peon

    Messages:
    347
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks. I have made it work but it does not land on the particular section as accurately as I would like.
     
    coldnorth, Apr 24, 2010 IP
  4. Nordvind

    Nordvind Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Try to add #id at the end of the link. #id - id of element on page you want to point to. So if you got a list of words on a glossary page it might look like this: <a href="http://www.yoursite.com/glossary.php#thisword">Link</a>.
     
    Nordvind, Apr 24, 2010 IP
  5. coldnorth

    coldnorth Peon

    Messages:
    347
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    That is pretty much what I did Nordvond, except for this php as this is an HTML document. It would get the page but never land on the section I wanted, usually just near the top of the page and when you scrolled down the target terms would be highlighted.
     
    coldnorth, Apr 24, 2010 IP
  6. Nordvind

    Nordvind Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Wrap every searched element in div block, and link on that blocks. Works fine even in html, just checked.
     
    Nordvind, Apr 24, 2010 IP
  7. lichtheman

    lichtheman Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Wrap the area with a div, and then connect to it with www.yoursite.com/page#divid
     
    lichtheman, Apr 24, 2010 IP
  8. markisonfire

    markisonfire Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    If you had a <div> that we will call destination, then you could have the code as <div id="destination">This is your destination's text</div>. You could link to that destination ONLY WITHIN THAT PAGE by <a href="#destination">link</a>. Hope that helps :)
     
    markisonfire, Apr 25, 2010 IP
  9. coldnorth

    coldnorth Peon

    Messages:
    347
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #9
    The section the target text is in actually is in DIV tags but the tags encompass a large section of the document. I think for the time being I am going to put this off as I really do not want to make any large layout changes at this time. Thanks for all your help guys.
     
    coldnorth, Apr 25, 2010 IP
  10. Vontage

    Vontage Peon

    Messages:
    141
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    page A : "<a href="b.html#g">link</a>"
    page B : "<!-- content -->
    <h1 id="g">target</h1>"
     
    Vontage, Apr 25, 2010 IP