Whats a property I add to my css that prevents my webpage from going all the way back to the top of the page everytime I refresh the page?

I want it so that everytime I refresh my page, its at the current spot on my page, rather than my page going all the way back to the top each time I refresh my page, just as I stated in the title.

No such thing. If you hit the browser Refresh/Reload button, the page will reload.

If you want to load new page content without causing a browser refresh, you can use Ajax (or some JS framework and Axios) to get the new content and replace the existing content in your div. Then only that affected div will refresh its content. The rest of the page stays the same.

What exactly are you trying to do?

1 Like

I think, but I’m not sure because I’ve never used it, that you could do something like this:

  • Give an id to each section of the page
  • Through JS events save the id of the last visited section in the local storage of the browser
  • After the document has loaded you can retrieve the id from the storage and move the page to that position

I hope it works.
Happy coding :slight_smile: