How to scroll smoothly to any section of the page with just one line of css?

1 · Ram · Sept. 22, 2024, 4:40 p.m.
To enable smooth scrolling when clicking an <a> tag in any website, you can add the below CSS code. If you want all anchor links to scroll smoothly, you can do so by applying the scroll-behavior property in your global CSS. Steps: Create/Modify your global CSS file (e.g., styles/globals.css): html { scroll-behavior: smooth; } This will ensure smooth scrolling across the entire page whenever the user clicks on an anchor link that targets a section of the page. Ensure your links use proper a...