Home > Software design >  When moving pages, you should be anchored to the top of the next page, some pages you are anchored t
When moving pages, you should be anchored to the top of the next page, some pages you are anchored t

Time:05-22

When I move to another page I get anchored to the bottom of the page. Is there any way I can fix this ?

How can I do it with React?

CodePudding user response:

The HTML standard's #scroll-to-the-fragment-identifier section specifies the display behavior. The standard is very specific in terms of the decision tree and there are several options to consider, but MDN's <a>: The Anchor element illustrates a possible easy solution:

You can use href="#top" or the empty fragment (href="#") to link to the top of the current page

As for React, that's a Javascript framework and Javascript can dynamically write HTML or control the UI.

  • Related