Home SEO Tools FAQs Guest post Contact Donate

Adding a floating “back to top” button

| 23 comments

Back to Top button or link is a link that sends your viewer to the top of page once clicked. This will help your readers navigate better, especially so if you have long pages. This link is usually located at the bottom of page or in the footer area.

back to top

What I am going explain in this article is slightly different. The function is the same yet the location of the link/button is different. As the name suggests, we are making a floating (or is it static) button. The button will float at the bottom of your screen. It will stay there even if you scroll the page, and can be seen at all times. We will do this using only a short HTML code, with a little inline styling.

Note: This trick will not work in older versions of Internet Explorer. The button will appear nonetheless, but at the center bottom of your page, and it doesn’t float.

Here are the steps:

  1. Login to your Blogger account.
  2. Go to Dashboard > Design > Edit HTML.
  3. Back up your template.
  4. Insert the following code immediately before the </body> tag in your HTML.
    <a style="position: fixed; bottom:5px;left:5px;" href="#" title="Back to Top"><img style="border: none;" src="YourButtonUrl"/></a>

    Replace YourButtonUrl with the link to your button or icon.

  5. If you prefer to use text instead of an image, use this code:
    <a style="position: fixed; bottom:5px;left:5px;" href="#" title="Click to go to top">YourTextHere</a>

    Replace YourText with your own wording.

  6. You can change the location of the button / link by changing the values of this code:

    bottom:5px; left:5px;

Enjoy!

 

23 comments to "Adding a floating “back to top” button"

LavaBlogger August 13, 2009 1:06 AM    

hi please can you tatch me how can i insert a html code in blogger post just like you ;)

Greenlava August 13, 2009 1:28 AM    

It is explained in How to show code in blog post

La Danse de Puck October 29, 2009 7:16 AM    

Many thanks for this tutorial. I stole your button for a bit as I must find one that I like... and upload and change the url! Don't murder me... but it goes well because the background is solid black.

Greenlava October 29, 2009 6:34 PM    

La Danse de Puck,
My mail ordered machete hasn't arrived yet, so I'm letting you off...for now :). Psst... don't tell anyone else, but I didn't pay for the button either :)

Miss Kayla December 8, 2009 7:41 AM    

Worked like a charm! Thanks!

365cheapdates December 8, 2009 7:45 AM    

It took me some time to configure this, but I love it!! You saved me so much space on my blog. I just wish that I knew how to integrate the search bar into the same menu bar, just like it is in your blog... Thanks!

Greenlava December 8, 2009 1:26 PM    

Miss Kayla,
I put the search bar code inside the menu bar HTML gadget, like this:
(start of menu bar code)
Menu bar code
[span style="float: right; and more styling codes here">MY SEARCH CODE HERE[/span]
(end of menu bar code)
Don't add Google Search from Blogger gadget list because you won't be able to pickout the code. I use Lijit.

Cikgu Norza January 4, 2010 5:58 PM    

I changed the position to the bottom right corner..--> [bottom:5px;right:5px;]
Thanks...

kcblogger June 1, 2010 2:59 AM    

sir ,
i am subhrajyoti ... I have a blog

http://krazzycollections.blogspot.com/

please tell me how i can use floating follow button(google friend connect) using html.

Greenlava June 2, 2010 12:14 PM    

@kcblogger
Sorry I'm afraid you can't float just the button, because it is located inside an iframe (inside the Followers widget).

FacetiousMuse July 13, 2010 6:53 AM    

Would this work for me. I have read more on my blog (ty btw) and when you read more it actually goes from the home page pf blog to the subpage that certain posting is. I need to have a button there after someone clicks read more they can go back to blog home page. Would this work since just top to page? I know i could use html coding to make go back a page but i do not know where i would place it in blogger and it is stationary and i really like the look of floating button. thank you in advance

Greenlava July 14, 2010 11:58 AM    

@FacetiousMuse
To make the button go to homepage, replace href="#" with href="YourBlogURL", i.e href="http://silviaterigi.blogspot.com/"

SABUN September 6, 2010 2:12 PM    

great tip.thanx!

chakrees December 5, 2010 10:03 AM    

Wonderful !! it worked nicely for me

Anonymous,  December 17, 2010 12:12 PM    

All i can say is thank you so much!!!!

Tera@® January 7, 2011 2:26 PM    

It's very nice tip but how can i find this icons same like you?

Greenlava January 7, 2011 9:50 PM    

@Tera@®
Just copy them. Right-click and choose "Save Image as..."

TechiOtaku April 30, 2011 10:48 PM    

Please tell us how to add matching template back to top button
http://techiotaku.blogspot.com/

Our blog is a technology,gaming and anime blog..so we would like to have a back top button..we would be delighted to hear from you.

Zawatil May 5, 2011 12:34 AM    

Like the tips.. Thanks. :x

JL September 2, 2011 8:30 PM    

Hi, is there a way to put instead of the button only a grafik without linking anywhere? The style should be there to place the grafik in the desired place. I tried to alternate the code but it did not work.
Thank you.

Greenlava September 6, 2011 10:43 PM    

@JL
You can do that by removing the href attribute:
[a style="position: fixed; bottom:5px;left:5px;" title="Back to Top"][img style="border: none;" src="YourButtonUrl"][/a]

Infoshare September 14, 2011 3:27 AM    

Works fine in my blog

Anonymous,  March 29, 2012 12:58 PM    

thanks, this is exactly what i was looking for

We love to hear from you! Leave us a comment.

To ensure proper display, HTML/XML/Javascript need to be escaped first using this escape tool. Then paste the escaped code here.

If your question is unrelated to this article, please post on our Facebook page.

Pls share this page

Get this
Click to go to top Click to comment