Is there a method in html which makes the webpage scroll to a specific Element using HTML !?
If you want to scroll the current document to a particular place, the value of HREF should be the name of the anchor to which to scroll, preceded by the # sign. If you want to open another document at an anchor, give the URL for the document, followed by #, followed by the name of the anchor.
Definition and UsageThe scrollIntoView() method scrolls an element into the visible area of the browser window.
You can use . scrollIntoView() for this. It will bring a specific element into the viewport.
Yes you use this
<a href="#google"></a> <div id="google"></div>
But this does not create a smooth scroll just so you know.
You can also add in your CSS
html { scroll-behavior: smooth; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With