How to make a back-to-top button using CSS and HTML only?

前端 未结 12 1649
别那么骄傲
别那么骄傲 2020-12-28 16:11

What i\'m trying to do is kind of like a back to top button but to scroll down and up to a certain point on the page! Say for instance you have a long text and

12条回答
  •  再見小時候
    2020-12-28 16:28

    I used a form with a single submit button. Point the "action" attribute to the ID of the element that needs to be navigated to. Worked for me with just "#top" without needing to define an ID in my stylesheet:

    Maybe a couple extra lines than is desirable but it's a button, at least. I find this the most concise and descriptive way to go about it.

提交回复
热议问题