SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do you put a link in XHTML code that will return a visitor to the top of a page

    How do you place a link in XHTML that will take a visitor at your site from the bottom of a page back to the top of the same page?

    I need the code for both the bottom of the page and also the code that you place at the top of the same page.

    Thank you,

    Jim

  2. #2
    Who is Mr Blonde? Mr Blonde's Avatar
    Join Date
    Sep 2006
    Location
    Gold Coast, QLD
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    add an id to an item at the top of the page, then put in a link to that id at the bottom. eg:
    HTML Code:
    <div id="header"></div>
    
    
    <a href="#header">Go to top of page</a>
    hope that helps
    Heavens Rejects : Online Clothing Store
    Alternative Clothing : Mr Blonde
    Front end development : By the Webfella

  3. #3
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or just do this:
    HTML Code:
    <a id="top" name="top"></a> <!-- remove this comment (you won't need it at all); oh, and remove the name="" attribute if using a Strict DOCTYPE as well -->
    ...
    <a href="#top">Return to top of page</a>

  4. #4
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Mr. Blonde and Dan Schultz for your help.

    Jim

  5. #5
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mr. Blonde,
    If I use your solution, is there a way that I can have it so that the text is smaller and centered at the bottom of the web page without affecting the h1 heading that I attached the header to?

    Actually, I just figured out the solution to this problem, after I had some time to think about it.

    Here is what I did at the top of my web site;

    HTML Code:
    </head>
      <body>
    
    
       <div class="content">
    
    
        <div id="header">
    
        <h1>"Discover simple, inexpensive techniques to photograph jewelry!!!"</h1>
    
        </div>
    Here is what I did at the bottom of my web page;

    HTML Code:
     <div id="bottom">
    
           <p><a href="#header">Return to top of page</a></p>
    
         </div> <!-- end of bottom div -->
    I then made a new part of my CSS and called it bottom. I put in the following;

    #bottom {
    color: teal;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 0.5em;
    line-height: 1.0em;
    text-align: center;
    }


    PROBLEM SOLVED!

    Thank you for your help.

    Jim
    Last edited by grdbum; Feb 17, 2007 at 14:40. Reason: I figured out a solution to my question.

  6. #6
    Who is Mr Blonde? Mr Blonde's Avatar
    Join Date
    Sep 2006
    Location
    Gold Coast, QLD
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cool, glad you figured it out.

    ...Just a tip: you dont need to use divs every time you use an id- you can apply it other block elements in your case. eg:
    HTML Code:
    </head>
      <body>
    
    
       <div class="content">
    
        <h1 id="header">"Discover simple, inexpensive techniques to photograph jewelry!!!"</h1>
    HTML Code:
    <p id="bottom"><a href="#header">Return to top of page</a></p>
    or if you dont have your header id styled you could just use
    HTML Code:
    </head>
      <body>
    
    
       <div class="content">
    
        <h1>"Discover simple, inexpensive techniques to photograph jewelry!!!"</h1>
    HTML Code:
    <p id="bottom"><a href="#content">Return to top of page</a></p>
    Heavens Rejects : Online Clothing Store
    Alternative Clothing : Mr Blonde
    Front end development : By the Webfella

  7. #7
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Mr. Blonde,

    Thank you very much for the tip.

    Jim


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
  •