My question is that in web page we should apply smooth scrolling with CSS or Javascript. I know how to do it with both, i just want to know that Which would be a better option?
Use css:
scroll-behavior: smooth;
Use scroll-behavior property in the html element to enable smooth scrolling for the whole page.
html {
scroll-behavior: smooth;
}
Using JavaScript read this .
Please read this blog: https://www.lambdatest.com/blog/browser-compatible-smooth-scrolling-with-css-js-jquery/
It might be helpful for you and determined which way is better for your requirements.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.