Interactivity

pointer-events

用於控制元素是否回應指標事件的通用類別。

ClassStyles
pointer-events-auto
pointer-events: auto;
pointer-events-none
pointer-events: none;

範例(Examples)

忽略指標事件(Ignoring pointer events)

使用 pointer-events-none 通用類別使元素忽略指標事件,例如 :hoverclick 事件:

點擊搜尋圖示以查看預期行為

pointer-events-auto

pointer-events-none

<div class="relative ...">  <div class="pointer-events-auto absolute ...">    <svg class="absolute h-5 w-5 text-gray-400">      <!-- ... -->    </svg>  </div>  <input type="text" placeholder="Search" class="..." /></div><div class="relative ...">  <div class="pointer-events-none absolute ...">    <svg class="absolute h-5 w-5 text-gray-400">      <!-- ... -->    </svg>  </div>  <input type="text" placeholder="Search" class="..." /></div>

指標事件仍會在子元素上觸發,並穿透到目標「下方」的元素。

恢復指標事件(Restoring pointer events)

使用 pointer-events-auto 通用類別來恢復指標事件的預設瀏覽器行為:

<div class="pointer-events-none md:pointer-events-auto ...">  <!-- ... --></div>
Copyright © 2026 Tailwind Labs Inc.·商標政策(Brand)