六维教程

Tailwind CSS scroll-behavior

用于控制元素滚动行为的工具。

基本用法

平滑滚动

使用scroll-smooth类实现元素内的平滑滚动。

<div class="scroll-smooth">
  <!-- 内容 -->
</div>

普通滚动

使用scroll-auto类将滚动行为恢复为默认浏览器行为。

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

语法速查

类名 语法
scroll-auto scroll-behavior: auto;
scroll-smooth scroll-behavior: smooth;
上一篇
Taiwind CSS min-height