DEV Community

I-BLACKPANTHER
I-BLACKPANTHER

Posted on

How to Scroll to Top using Button.

Here in this post i will give a step by step information about how to create a Scroll to top button.

Step 1: Add HTML:

Alt Text

Step 2: Add CSS:

Alt Text

Step 3: Add JavaScript:

Get the button:

Alt Text

When the user scrolls down 25px from the top of the document, show the button.

Alt Text

When the user clicks on the button, scroll to the top of the document.

Alt Text

That's all guys , now you can use this special button to make the things easier.

Top comments (0)