Interactivity

scroll-behavior

用於控制元素捲動行為的通用類別。

ClassStyles
scroll-auto
scroll-behavior: auto;
scroll-smooth
scroll-behavior: smooth;

範例(Examples)

使用平滑捲動(Using smooth scrolling)

使用 scroll-smooth 通用類別在元素內啟用平滑捲動:

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

設定 scroll-behavior 只會影響由瀏覽器觸發的捲動事件。

使用正常捲動(Using normal scrolling)

使用 scroll-auto 通用類別來恢復捲動的預設瀏覽器行為:

<html class="scroll-smooth md:scroll-auto">  <!-- ... --></html>
Copyright © 2026 Tailwind Labs Inc.·商標政策(Brand)