VOOZH about

URL: https://www.geeksforgeeks.org/css/how-to-implement-smooth-scrolling-using-tailwind-css/

⇱ How to Implement Smooth Scrolling using Tailwind CSS ? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to Implement Smooth Scrolling using Tailwind CSS ?

Last Updated : 23 Jul, 2025

Smooth scrolling refers to the scrolling of a section of the webpage when the respective link is clicked. By default when we click a link it skips directly to that element using smooth scrolling the UX improves a lot. Tailwind CSS provides a utility class named scroll-smooth which applies the CSS property of scroll-behaviour with a value of smooth.

Approach

  • Create a layout in the HTML file, Use the script tag with the src value of a CDN link to use Tailwind CSS.
  • Add a scroll-smooth class name to the HTML tag. Smooth scrolling functionality is implemented using anchor tags <a> with href attributes pointing to specific sections (#section1, #section2, #section3) within the page.
  • The section must have an id which will used in the anchor tag for the href value.
  • Provide appropriate height to each section such that it overflows the page and provides us with a scroll bar.

Example: implement smooth scrolling using Tailwind CSS.

Output:

👁 Output-Edited
Output
Comment
Article Tags: