Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 1
Sign in to follow this  
NCB

How can I create an anchor link for a Back to Top button?

Question

Hi all. I wanna create a back to top button at the end of my home page which is an index made of 4 pages. I wanna add the button to the very bottom of course and I want it to take the viewer to the very top (again, of course).

I asked for help from customercare but apparently since it requires some coding they cannot help with it much other than sending a sheet that is clear as mud and that sounds like brain surgery to me (yes, I am clueless about how to code).

Can please someone help me with that by explaining it in plain everyday English? Thanks!

Edited by rhyann

Share this post


Link to post

7 answers to this question

Recommended Posts

  • 3

At the top of your home page insert a code block. In the block enter this HTML code:

<div id="Home-Page-Top"></div>

Be certain to delete the example text in the code block. Save the block.

At the bottom of the page where you want the Back To Top link to be, insert another code block. In the block enter this HTML code:

<a href="#Home-Page-Top">Back To Top↑</a>

Again, be certain to delete the example text. Save the block.

Save the page.

You should now have a link in the default style of all your other links which will take you back to the top.

If you want it styled differently, let me know how you want it to appear and what you want it to do when the mouse hovers over it. I will write some CSS code to do that.

If you do want further help, be sure to give me the url to your site.

For some examples of such a link at work, see my site at www.familyhistoryconferencenwa.org. Go to Class Descriptions. Click on one of the letters in the row of letters. You will jump to the point on the page where classes beginning with that letter are listed. At the bottom of each class description is a Top link.

To see some links on one page that will take you back to a point on another page, click on one of the instructor's name (below the class title). You will jump to a page with info about that instructor. At the bottom is a link which will take you back to the point from which you jumped.

For an example of a link with some (minimal) styling, see the Printable Version link on the Class Schedule page.

Let me know if this code works for you.


I'm a retired attorney who was asked by a friend to build a website. In a prior lifetime, in a galaxy far, far away and long, long ago, I was a computer systems analyst / programmer. I'm a novice autodidact in CSS, JavaScript and HTML learning in part by example.. I've asked questions on this forum and been lucky enough to have others help me, so I'm inclined to answer any question I can. Pay it forward.

Share this post


Link to post
  • 0

I didn't have time to try it yet but I can tell you that you couldn't explain simpler and better. Thank you very much. I'll give it a try and will let you know about the style. Thanks again.

Share this post


Link to post
  • 0

@alxfyv I used your codes and created the button but you guessed right, I don't really like how it looks. Here's the link to my website http://nazlibinyildirim.com

On the home page there is a Get in Touch button. I want my back to top button look like that one if possible. It's ok if they are not completely identical but I would at least prefer them to be consistent. Also is there a way to place it in the middle? It aligns to the left.

Thanks!

Share this post


Link to post
  • 0

In the code block where the Back To Top button is, enter


<pre><code>`<div class="back-to-top">
<a: href="#Home-Page-Top"Back To Top</a>
</div>`</code></pre>In custom CSS enter<pre><code>.back-to-top {
 display: inline-block;          /* omit for left aligned button  */
 height: 10px;
 width: 30px;
 text-align: center;
 color: #000000;
 border: solid 1px;
 border-color: #000000;
 background-color: #ffffff;
 }

.back-to-top a:hover {
 background-color: #000000;
 color: #ffffff;
 border-color: #000000;
}</code></pre><code></code>

Adjust the height and width to make the border correctly surround the text.

This should give you a centered button behaving similarly to the rest of your buttons.

Let me know whether this works for you and if you want anything changed.

Edited by alxfyv
edit code

I'm a retired attorney who was asked by a friend to build a website. In a prior lifetime, in a galaxy far, far away and long, long ago, I was a computer systems analyst / programmer. I'm a novice autodidact in CSS, JavaScript and HTML learning in part by example.. I've asked questions on this forum and been lucky enough to have others help me, so I'm inclined to answer any question I can. Pay it forward.

Share this post


Link to post
  • 0

@alxfyv I enter both of these to the bottom code block, the first to the HTML and the second to the CSS. Also for HTML I replace what's there with this new one, not add the new one to the one that I entered before. Did I get it right?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in to follow this  

×
×
  • Create New...