透過 cursor 屬性即可改變滑鼠游標外觀,以下為常用關鍵字與效果對照:
| CSS 關鍵字 | 外觀描述 | 範例代碼 |
|---|---|---|
hand / pointer | 手型(連結預設) | <span style="cursor:pointer">手型</span> |
crosshair | 十字準星 | <span style="cursor:crosshair">十字</span> |
text | I 型文字編輯 | <span style="cursor:text">文字游標</span> |
wait | 等待(沙漏/轉圈) | <span style="cursor:wait">等待</span> |
default | 預設箭頭 | <span style="cursor:default">預設</span> |
help | 問號 | <span style="cursor:help">說明</span> |
e-resize | 左右雙箭頭(水平縮放) | <span style="cursor:e-resize">左右</span> |
s-resize | 上下雙箭頭(垂直縮放) | <span style="cursor:s-resize">上下</span> |
auto | 瀏覽器自動判斷 | <span style="cursor:auto">自動</span> |
cursor: url('cursor.cur'), auto;(需提供 .cur/.ani 檔,並設 fallback)。grab、grabbing、zoom-in、zoom-out、not-allowed、col-resize、row-resize 等,支援度極高。style 或 CSS 規則中,如 button { cursor: pointer; }。提醒:早期 IE 僅支援 hand,現代瀏覽器統一支援標準 pointer,建議直接使用 pointer。