Tailwind CSS - Scroll Behavior



Tailwind CSS Scroll Behavior is a collection of predefined classes that manage scrolling effects, enabling either smooth or instant scrolling and allowing control over scroll timing.

Tailwind CSS Scroll Behavior Classes

Below is a list of Tailwind CSS Scroll Behavior classes for managing the scrolling behavior of elements.

Class CSS Properties
scroll-auto scroll-behavior: auto;
scroll-smooth scroll-behavior: smooth;

Functionality of Tailwind CSS Scroll Behavior Classes

  • scroll-auto: This class uses the default scrolling behavior of the browser.
  • scroll-smooth: This class makes scrolling smooth and easy.

Tailwind CSS Scroll Behavior Class Examples

Below are examples of Tailwind CSS Scroll Behavior classes that show how to control scrolling smoothness within an element. These classes enable smooth scrolling effects to enhance the user experience.

Default and Smooth Scrolling

This example shows how Tailwind CSS scroll behavior classes work. The scroll-autoclass uses the browser's default scrolling, while the scroll-smooth class provides smooth, easy scrolling.

Example

  



    



    

Tailwind CSS Scroll Behavior

Scroll Auto

Default scrolling behavior.

Uses the browser's default scrolling.

Scroll Smooth

Smooth scrolling behavior.

Provides smooth, easy scrolling.

Tailwind CSS Scroll Behavior with Hover Effects

This example shows Tailwind CSS scroll behavior with hover effects. Both scroll-auto and scroll-smooth classes enable smooth scrolling, but with hover effects that change the background and border color.

Example




    



    

Tailwind CSS Scroll Behavior

Scroll Auto

Smooth scrolling behavior.

Uses the browser's default scrolling.

Scroll Smooth

Smooth scrolling behavior.

Provides smooth, easy scrolling.

Advertisements