www.webdeveloper.com
Results 1 to 3 of 3

Thread: how do you use id for anchors

  1. #1
    Join Date
    Jul 2012
    Location
    Vantaa, Finland
    Posts
    125

    Smile how do you use id for anchors

    I want to place some anchors on my page but they don't work.

    I have tried using;
    <div id="menu" style="position: relative"><a>name="up"</a>
    but it seems that name is now obsolete.

    I am now using;
    <div id="menu" style="position: relative"><a> id="up"</a>
    but all I get is "id="up" printed on the screen.

    I have used;
    <a> href="#up"</a>
    further down the page.

    How should I code the anchors for the above 2 examples?

    If it makes life easier I can try putting "position: relative" in the css file that I have made for this page.

    Thanks.

  2. #2
    Join Date
    Sep 2011
    Location
    Bristol, England, United Kingdom
    Posts
    192
    Code:
    <a href="http://www.google.com">Google</a>
    <a href="http://www.google.com" id="google">Google</a>
    <a href="http://www.google.com" id="google" name="google">Google</a>
    etc.

  3. #3
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,217
    Named Anchors:

    Those are called named anchors. Scroll down to the title "The name Attribute" for good examples: http://www.w3schools.com/HTML/html_links.asp

    You can edit and try out your own code online here: http://www.w3schools.com/HTML/tryit....link_locations

    Examples:

    Linking from a section on one web page to a section on another web page:

    Using an image as the link:

    Code:
    <div><a href="http:// your_site.com/ html_links.htm#animals"><img style="width: XXpx; height: YYpx; border: 0;" src="Path to image" alt="Text Description"></a></div>
    (Spaces added to show all the code for "href")

    Text Link:

    Code:
    <div><a href="http://your_site.com/html_links.htm#animals">Visit My Animals Photos</a></div>
    Target Text Link on External Page:
    Code:
    <div><a id="animals">My Animals Photos</a></div>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles