1. 互動性
  2. scroll-behavior

互動性

scroll-behavior

用於控制元素捲動行為的 Utility。

Class樣式
scroll-auto
scroll-behavior: auto;
scroll-smooth
scroll-behavior: smooth;

範例

使用平滑捲動

使用 scroll-smooth Utility 啟用元素內的平滑捲動。

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

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

使用正常捲動

使用 scroll-auto Utility 還原為瀏覽器預設的捲動行為。

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