Add a Scroll-to-Top Button to your Website

  Scroll


Adding a scroll-to-top button to your website adds further ease of navigation to your website...

Add a Scroll-to-Top Button to your Website

Adding a sticky scroll-to-top button to your website adds further ease of navigation to your website by allowing a user to scroll to the top of any given web page with the click of a button. 

Below is the HTML, CSS, and JavaScript required to add this functionality to your website.


Step 1 - Add the HTML below to your web page


Step 2 - Add the CSS below to the main stylesheet of your website


Step 3 - Add the code below to a file called scroll.js


Step 4 - Add the includes below to the pages where your button lives

Author

Scott Madara
Contributions Editor here at Solodev. Want to be featured on the Solodev Blog? Get in touch.
Follow me on Twitter

Get started today

Join people and businesses across the globe that trust Solodev.

We never share your information with anyone. Learn more

We use cookies to provide and improve our services. By using our site, you consent to cookies.