
- CSS 教程
- CSS - 首頁
- CSS - 路線圖
- CSS - 簡介
- CSS - 語法
- CSS - 選擇器
- CSS - 包含
- CSS - 測量單位
- CSS - 顏色
- CSS - 背景
- CSS - 字型
- CSS - 文字
- CSS - 圖片
- CSS - 連結
- CSS - 表格
- CSS - 邊框
- CSS - 塊級邊框
- CSS - 內聯邊框
- CSS - 外邊距
- CSS - 列表
- CSS - 內邊距
- CSS - 遊標
- CSS - 輪廓
- CSS - 尺寸
- CSS - 捲軸
- CSS - 塊級內聯
- CSS - 下拉選單
- CSS - 可見性
- CSS - 溢位
- CSS - Clearfix
- CSS - 浮動
- CSS - 箭頭
- CSS - 調整大小
- CSS - 引號
- CSS - 順序
- CSS - 位置
- CSS - 連字元
- CSS - 懸停
- CSS - 顯示
- CSS - 焦點
- CSS - 縮放
- CSS - 平移
- CSS - 高度
- CSS - 連字元字元
- CSS - 寬度
- CSS - 不透明度
- CSS - Z-Index
- CSS - 底部
- CSS - 導航欄
- CSS - 疊加層
- CSS - 表單
- CSS - 對齊
- CSS - 圖示
- CSS - 圖片庫
- CSS - 註釋
- CSS - 載入器
- CSS - 屬性選擇器
- CSS - 組合器
- CSS - 根元素
- CSS - 盒模型
- CSS - 計數器
- CSS - 剪裁
- CSS - 書寫模式
- CSS - Unicode-bidi
- CSS - min-content
- CSS - 全部
- CSS - 內嵌
- CSS - 隔離
- CSS - 溢位滾動
- CSS - Justify Items
- CSS - Justify Self
- CSS - Tab Size
- CSS - 指標事件
- CSS - Place Content
- CSS - Place Items
- CSS - Place Self
- CSS - 最大塊級尺寸
- CSS - 最小塊級尺寸
- CSS - 混合模式
- CSS - 最大內聯尺寸
- CSS - 最小內聯尺寸
- CSS - 偏移
- CSS - 口音顏色
- CSS - 使用者選擇
- CSS 高階
- CSS - 網格
- CSS - 網格佈局
- CSS - Flexbox
- CSS - 可見性
- CSS - 定位
- CSS - 圖層
- CSS - 偽類
- CSS - 偽元素
- CSS - @規則
- CSS - 文字效果
- CSS - 分頁媒體
- CSS - 列印
- CSS - 佈局
- CSS - 驗證
- CSS - 圖片精靈
- CSS - !important
- CSS - 資料型別
- CSS3 教程
- CSS3 - 教程
- CSS - 圓角
- CSS - 邊框圖片
- CSS - 多重背景
- CSS - 顏色
- CSS - 漸變
- CSS - 盒陰影
- CSS - 盒裝飾中斷
- CSS - 游標顏色
- CSS - 文字陰影
- CSS - 文字
- CSS - 2D 變換
- CSS - 3D 變換
- CSS - 過渡
- CSS - 動畫
- CSS - 多列
- CSS - 盒尺寸
- CSS - 工具提示
- CSS - 按鈕
- CSS - 分頁
- CSS - 變數
- CSS - 媒體查詢
- CSS - 函式
- CSS - 數學函式
- CSS - 遮罩
- CSS - 形狀
- CSS - 樣式圖片
- CSS - 特異性
- CSS - 自定義屬性
- CSS 響應式
- CSS RWD - 簡介
- CSS RWD - 視口
- CSS RWD - 網格檢視
- CSS RWD - 媒體查詢
- CSS RWD - 圖片
- CSS RWD - 影片
- CSS RWD - 框架
- CSS 工具
- CSS - 畫素到EM轉換器
- CSS - 顏色選擇器和動畫
- CSS 資源
- CSS - 有用資源
- CSS - 討論
CSS - 遊標屬性
CSS cursor 屬性決定了滑鼠懸停在應用此屬性的元素上時的外觀。其主要目的是透過視覺方式表示某些功能來提高可用性。
語法
cursor: value;
屬性值
值 | 描述 |
---|---|
auto | 顯示的遊標由使用者代理根據當前上下文確定。這是瀏覽器用於定義遊標的預設屬性。 |
alias | 顯示的遊標是別名遊標,表示需要生成別名或快捷方式。 |
all-scroll | 顯示的遊標表示已完成滾動。 |
cell | 顯示的遊標是單元格遊標,表示可以選擇表格單元格或單元格組。 |
col-resize | 顯示的遊標是列調整大小遊標,表示元素或列可能會進行水平調整大小,通常表示為左右指向的箭頭,用垂直線隔開。 |
copy | 顯示的遊標是複製遊標,表示需要建立某個內容的副本。 |
crosshair | 顯示的遊標是十字準星遊標,通常用於指示點陣圖中元素的選擇。 |
default | 預設遊標,根據平臺而異,通常顯示為箭頭。 |
e-resize | 顯示的遊標是南向調整大小遊標,表示南側可以移動或偏移。 |
ew-resize | 顯示的遊標是東西向調整大小遊標,表示雙向調整大小的遊標。 |
grab | 顯示的遊標是抓取遊標,表示可以抓取元素並將其拖動以重新定位。 |
grabbing | 顯示的遊標是抓取遊標,表示正在握住或拉動某物以方便其移動。 |
help | 顯示的遊標是幫助遊標,表示可以訪問幫助資訊。 |
move | 顯示的遊標是移動遊標,表示可以重新定位某物。 |
n-resize | 顯示的遊標是北向調整大小遊標,表示北側可以移動或偏移。 |
ne-resize | 顯示的遊標是東北向調整大小遊標,表示雙向調整大小的遊標。 |
nw-resize | 顯示的遊標是西北向調整大小遊標,表示雙向調整大小的遊標。 |
ns-resize | 顯示的遊標是南北向調整大小遊標,表示雙向調整大小的遊標。 |
nesw-resize | 顯示的遊標是東北西南向調整大小遊標,表示雙向調整大小的遊標。 |
nwse-resize | 顯示的遊標是西北東南向調整大小遊標,表示雙向調整大小的遊標。 |
no-drop | 顯示的遊標是禁止放置遊標,表示可能無法在其當前位置放置專案。 |
not-allowed | 顯示的遊標是禁止遊標,表示不會執行請求的操作。 |
pointer | 顯示的遊標是指標遊標,表示遊標用作指向超連結的指示器。 |
progress | 顯示的遊標是進度遊標,表示程式正在執行後臺任務,允許使用者繼續與介面互動,而不必等待其完成。 |
row-resize | 顯示的遊標是行調整大小遊標,表示元素或行可能會進行垂直調整大小,通常表示為向上和向下指向的箭頭,用水平線隔開。 |
s-resize | 顯示的遊標是南向調整大小遊標,表示南側可以移動或偏移。 |
se-resize | 顯示的遊標是東南向調整大小遊標,表示雙向調整大小的遊標。 |
sw-resize | 顯示的遊標是西南向調整大小遊標,表示雙向調整大小的遊標。 |
text | 顯示的遊標是文字遊標,表示您可以選擇通常由 I 形遊標指示的文字。 |
URL | 顯示的遊標是由逗號分隔的 URL 指定的影像,如果影像無法使用,還必須在 URL 的末尾提供通用遊標。 |
wait | 顯示的遊標是等待遊標,程式當前正忙,使用者無法與介面互動,這種狀態有時用沙漏或手錶影像表示。 |
w-resize | 顯示的遊標是西向調整大小遊標,表示西側可以移動或偏移。 |
zoom-in | 顯示的遊標是放大遊標,表示可以透過縮放放大物件。 |
zoom-out | 顯示的遊標是縮小遊標,表示可以透過縮放縮小物件。 |
CSS 遊標屬性示例
以下示例演示了具有不同值的cursor 屬性。
所有遊標的演示
以下示例顯示了多個提到的遊標的演示,要觀察效果,請將滑鼠懸停在每個塊上。
示例
<!DOCTYPE html> <html> <head> <style> .demo-cursor { text-align: center; display: inline-block; width: 100px; height: 100px; margin: 10px; border: 3px solid #ccc; cursor: pointer; } .demo-cursor:hover { background-color: lightgrey; } .default:hover { cursor: default; } .auto { cursor: auto; } .crosshair { cursor: crosshair; } .pointer { cursor: pointer; } .move { cursor: move; } .text { cursor: text; } .wait { cursor: wait; } .help { cursor: help; } .not-allowed { cursor: not-allowed; } .progress { cursor: progress; } .alias { cursor: alias; } .copy { cursor: copy; } .no-drop { cursor: no-drop; } .e-resize { cursor: e-resize; } .n-resize { cursor: n-resize; } .ne-resize { cursor: ne-resize; } .nw-resize { cursor: nw-resize; } .s-resize { cursor: s-resize; } .se-resize { cursor: se-resize; } .sw-resize { cursor: sw-resize; } .w-resize { cursor: w-resize; } .ew-resize { cursor: ew-resize; } .ns-resize { cursor: ns-resize; } .nesw-resize { cursor: nesw-resize; } .nwse-resize { cursor: nwse-resize; } .col-resize { cursor: col-resize; } .row-resize { cursor: row-resize; } .zoom-in { cursor: zoom-in; } .zoom-out { cursor: zoom-out; } .grab { cursor: grab; } .cell { cursor: cell; } .grabbing { cursor: grabbing; } .all-scroll { cursor: all-scroll; } </style> </head> <body> <h2> CSS cursor property </h2> <h3> All CSS Cursors, hover the mouse on the blocks. </h3> <div class="demo-cursor auto"> <h3> Auto </h3> </div> <div class="demo-cursor alias"> <h3> Alias </h3> </div> <div class="demo-cursor all-scroll"> <h3> All-scroll </h3> </div> <div class="demo-cursor cell"> <h3> cell </h3> </div> <div class="demo-cursor col-resize"> <h3> col-resize </h3> </div> <div class="demo-cursor copy"> <h3> Copy </h3> </div> <div class="demo-cursor crosshair"> <h3> Crosshair </h3> </div> <div class="demo-cursor default"> <h3> Default </h3> </div> <div class="demo-cursor e-resize"> <h3> e-resize </h3> </div> <div class="demo-cursor ew-resize"> <h3> ew-resize </h3> </div> <div class="demo-cursor grab"> <h3> Grab </h3> </div> <div class="demo-cursor grabbing"> <h3> Grabbing </h3> </div> <div class="demo-cursor help"> <h3> Help </h3> </div> <div class="demo-cursor move"> <h3> Move </h3> </div> <div class="demo-cursor n-resize"> <h3> n-resize </h3> </div> <div class="demo-cursor ne-resize"> <h3> ne-resize </h3> </div> <div class="demo-cursor nw-resize"> <h3> nw-resize </h3> </div> <div class="demo-cursor ns-resize"> <h3> ns-resize </h3> </div> <div class="demo-cursor nesw-resize"> <h3> nesw-resize </h3> </div> <div class="demo-cursor nwse-resize"> <h3> nwse-resize </h3> </div> <div class="demo-cursor no-drop"> <h3> No-drop </h3> </div> <div class="demo-cursor not-allowed"> <h3> Not-allowed </h3> </div> <div class="demo-cursor pointer"> <h3> Pointer </h3> </div> <div class="demo-cursor progress"> <h3> Progress </h3> </div> <div class="demo-cursor row-resize"> <h3> row-resize </h3> </div> <div class="demo-cursor s-resize"> <h3> s-resize </h3> </div> <div class="demo-cursor se-resize"> <h3> se-resize </h3> </div> <div class="demo-cursor sw-resize"> <h3> sw-resize </h3> </div> <div class="demo-cursor text"> <h3> Text </h3> </div> <div class="demo-cursor wait"> <h3> Wait </h3> </div> <div class="demo-cursor w-resize"> <h3> w-resize </h3> </div> <div class="demo-cursor zoom-in"> <h3> Zoom-in </h3> </div> <div class="demo-cursor zoom-out"> <h3> Zoom-out </h3> </div> </body> </html>
將影像設定為遊標
影像也可以用作遊標,必須提及所需影像的 URL。這在以下示例中顯示。
示例
<!DOCTYPE html> <html> <head> <style> .demo-cursor { text-align: center; display: inline-block; background-color: lightgrey; width: 100px; height: 100px; margin: 10px; border: 3px solid #ccc; cursor: url(/css/images/try-it.jpg), pointer; } </style> </head> <body> <h2> CSS cursor property </h2> <h3> Hover over the block </h3> <div class="demo-cursor"> <h3> Image Cursor </h3> </div> </div> </body> </html>
支援的瀏覽器
屬性 | ![]() |
![]() |
![]() |
![]() |
![]() |
---|---|---|---|---|---|
cursor | 5.0 | 5.5 | 4.0 | 5.0 | 9.6 |
css_properties_reference.htm
廣告