Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6

Thread: help needed

  1. #1
    Junior Member
    Join Date
    Dec 2007
    Posts
    1
    Member #
    16186
    How to create links to sections on the same page in HTML.

  2.  

  3. #2
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    In the location where you want to link to, give it the id="namehere" attribute. Any element on the page will do, perhaps a paragraph or a DIV. Anything. Then, in the link, just insert, in the href, "#namehere". It will then jump to that location when you click on it.

    HTML Code:
    <a href="#para">The Link!</a>
    
    <p id="para">
    Paragraph to link to
    </p>
    I think that should do it (my HTML is slightly rusty in that part). Oh, and btw, next time, please use a clearer topic title.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  4. #3
    Senior Member hyperair's Avatar
    Join Date
    May 2005
    Posts
    452
    Member #
    9892
    That won't work I think. You gotta put <a name="para"></a> somewhere inside the paragraph, or wherever you want the page to scroll to.

    So:
    Code:
    <a href="#para">The Link!</a>
    
    <p id="somethingelse">
    <a name="para"></a>
    Paragraph to link to
    </p>
    Hyperair

  5. #4
    Senior Member Shani's Avatar
    Join Date
    Nov 2004
    Posts
    1,140
    Member #
    8171
    To clear up confusion, hyperair has the correct syntax. No "id" is needed anywhere. Look at this article in W3 Schools
    Shani

    I have an eye for detail like you'd never believe.

  6. #5
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    Ah, my mistake. It's name, not ID. Sorry.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  7. #6
    Senior Member hyperair's Avatar
    Join Date
    May 2005
    Posts
    452
    Member #
    9892
    Don't forget that you need to use the anchor (<a>) element for marking the point to jump to.
    Hyperair


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:57 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com