Ask any question about CSS here... and get an instant response.
Post this Question & Answer:
How can I create a smooth scrolling effect with just CSS?
Asked on Mar 08, 2026
Answer
To create a smooth scrolling effect with CSS, you can use the `scroll-behavior` property. This property allows you to define how scrolling should behave, and setting it to "smooth" will enable a smooth transition when navigating through anchor links within the page.
<!-- BEGIN COPY / PASTE -->
html {
scroll-behavior: smooth;
}
<!-- END COPY / PASTE -->Additional Comment:
- The `scroll-behavior` property is applied to the root element (html) to affect the entire document.
- This feature is supported in most modern browsers, but it's good to check compatibility for older versions.
- It only affects scrolling triggered by anchor links or JavaScript scroll methods, not manual scrolling.
Recommended Links:
