​
Quick reference

Class
Properties
scroll-autoscroll-behavior: auto;
scroll-smoothscroll-behavior: smooth;

​
Basic usage

​
Adding smooth scrolling

Use the scroll-smooth utilities to enable smooth scrolling within an element.

<html class="scroll-smooth">
  <!-- ... -->
</html>

​
Applying conditionally

​
Hover, focus, and other states

Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:scroll-auto to only apply the scroll-auto utility on hover.

<html class="scroll-smooth hover:scroll-auto">
  <!-- ... -->
</html>

For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.

​
Breakpoints and media queries

You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:scroll-auto to apply the scroll-auto utility at only medium screen sizes and above.

<html class="scroll-smooth md:scroll-auto">
  <!-- ... -->
</html>

To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.