Краткая справка

Класс
Свойства
scroll-autoscroll-behavior: auto;
scroll-smoothscroll-behavior: smooth;

Основы использования

Добавление плавной прокрутки

Используйте утилиты scroll-smooth, чтобы включить плавную прокрутку внутри элемента.

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

Применяя условно

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.

Контрольные точки и медиа-запросы

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.