CSS游標cursor,csscursor

來源:互聯網
上載者:User

CSS游標cursor,csscursor
×目錄[1]定義 [2]標準樣式 [3]拓展樣式 [4]私人樣式 [5]定義樣式 [6]常見應用前面的話

  在瀏覽器中,游標對於提供互動反饋很有用。通過在不同的情境中改變游標,就能賦予其不同的含義。

 

定義

  cursor游標

  值: [<uri>,]*[auto | default | pointer | crosshair | move | e-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | text | wait | help | progress]] | inherit

  初始值: auto

  應用於: 所有元素

  繼承性: 有

 

標準樣式

  CSS2提供了相對較少的選擇

url: 自訂游標的URLdefault: 預設游標,通常是一個箭頭auto: 瀏覽器自動識別的游標crosshair : 十字線pointer: 手型指標move: 移動指標e-resize: 向東移動指標ne-resize: 向東北移動指標nw-resize: 向西北移動指標n-resize: 向北移動指標se-resize: 向東南移動指標sw-resize: 向西南移動指標s-resize: 向南移動指標w-resize: 向西移動指標text: 文本指標wait: 指示程式正忙help: 協助指標

拓展樣式

  CSS3增加了更多的cursor的樣式值

  [注意]所有拓展樣式IE7-瀏覽器都不支援

cursor:none (not IE8, Safari)cursor:context-menu (not Safari,Firefox,Chrome)cursor:cell (not Safari)cursor:alias (not Safari)cursor:copy (not IE,Safari)cursor:grab (not IE,Safari,Chrome)cursor:grabbing (not IE,Safari,Chrome)cursor:zoom-in (not IE,Safari)cursor:zoom-out (not IE,Safari)cursor:vertical-textcursor:no-dropcursor:not-allowedcursor:all-scrollcursor:ew-resizecursor:ns-resizecursor:nesw-resizecursor:nwse-resizecursor:col-resizecursor:row-resize

私人樣式

  有些瀏覽器還提供了增加瀏覽器首碼的私人樣式

  [注意]safari將-webkit-grab和-webkit-grabbing都解釋為default

cursor:-webkit-grab; cursor: -moz-grab;cursor:-webkit-grabbing; cursor: -moz-grabbing;cursor:-webkit-zoom-in; cursor: -moz-zoom-in;cursor:-webkit-zoom-out; cursor: -moz-zoom-out;    

自訂樣式

  所有瀏覽器都支援使用尾碼名為.cur的檔案,chrome、firefox、safari還支援使用普通圖片製作游標

  [注意]使用URL自訂樣式,後面必須跟有一個逗號和某個通用關鍵字

//錯誤cursor: url('m.cur');//正確cursor: url('m.cur'),auto;

常見應用

  連結的預設游標是手型指標pointer,通過游標的變化可以讓訪問者清楚的知道該元素是可點擊的

  元素的title屬性用來提供元素的額外資訊,配合help游標可以得到更好的表現方式

span[title]{    cursor: help;    border-bottom: 1px solid gray;}
<div><span title="Cascading Style Sheets">CSS</span> is much too interesting</div>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.