Ask any question about CSS here... and get an instant response.
Post this Question & Answer:
How can I create a smooth scrolling effect with CSS alone?
Asked on Apr 04, 2026
Answer
To create a smooth scrolling effect using only CSS, you can utilize the `scroll-behavior` property. This property allows you to define how scrolling should behave for a given element or the entire page.
<!-- BEGIN COPY / PASTE -->
html {
scroll-behavior: smooth;
}
<!-- END COPY / PASTE -->Additional Comment:
- The `scroll-behavior: smooth;` property is applied to the `html` element to affect the entire document.
- This CSS property only works for user-initiated scrolling, such as clicking on links with anchors.
- Ensure that your browser supports this feature, as it may not work in some older versions.
- No JavaScript is needed for this effect, making it a lightweight solution.
Recommended Links:
