SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Strict XHTML top-of-page navigation

    Hi,

    Can anyone help. I want to add a top-of-page link at the bottom of my web pages. If I use <a name="top"> and <p><a href="gallery.html#top">Top of Page</a></p> my website fails strict XHTML validation.

    I tried transitional XHTML but that fails to validate the div tags I am using, which is strange as they following the guidelines laid out at w3.org

    Pulling my hair out now, any idea's?

    Cheers

    P.S. The page I am trying to validate is:
    http://www.praiadaluzapartment.com/gallery.html

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HTML Code:
    <h1 id="top">Document Heading</h1>
    HTML Code:
    <a href="#top">Top of Page</a>
    (The target element doesn't necessarily have to be an h1, of course.)
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Guru Rob_D's Avatar
    Join Date
    Oct 2006
    Location
    UK
    Posts
    882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do this:

    1. Remove:
    HTML Code:
    <a NAME="top">
    and put
    HTML Code:
    <body id="top">
    2. Change:
    HTML Code:
    <p><a href="gallery.html#top">Return to the top of the page</a></p>
    to
    HTML Code:
    <p><a href="#top">Return to the top of the page</a></p>
    <a> tags must be within a p or h1 etc tag for this DOCTYPE. They cannot be on their own.
    It has yet to be proven that intelligence has any survival value.
    Arthur C. Clarke

  4. #4
    SitePoint Guru Rob_D's Avatar
    Join Date
    Oct 2006
    Location
    UK
    Posts
    882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    AutisticCuckoo beat me too it. Again!
    It has yet to be proven that intelligence has any survival value.
    Arthur C. Clarke

  5. #5
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    AutisticCuckoo, Rob_D,

    Thank you both very much. Worked a treat.

    Choppsie


Bookmarks

Posting Permissions

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