CSS如何?滑鼠游標形狀的變化?(執行個體示範)

來源:互聯網
上載者:User
相信大家在瀏覽各大網站時,會通過滑鼠的不同樣式帶來不同的體驗感受。本篇文章就給大家帶來通過CSS如何?滑鼠形狀的變化?css cursor屬性,有一定的參考價值,有需要的朋友可以參考一下,希望對你有所協助。

效果展示

cursor 屬性規定要顯示的游標的類型(形狀)。該屬性定義了滑鼠指標放在一個元素邊界範圍內時所用的游標形狀。所有主流瀏覽器都支援 cursor 屬性。

下面我們通過具體的css cursor 滑鼠的游標形狀變化的執行個體代碼,給大家詳細的一一介紹:

html代碼:定義容器

<div class="content"><div class="box box1"><a href="">CSS滑鼠手型效果</a></div><div class="box box2"><a href="">CSS滑鼠手型效果</a></div><div class="box box3"><a href="">CSS滑鼠十字型效果</a></div><div class="box box4"><a href="">CSS滑鼠問號效果</a></div><div class="box box5"><a href="">CSS滑鼠等待效果</a></div></div>

cursor的hand屬性是讓滑鼠顯示手型效果

.box1 a{background-color: red;cursor:hand;}

cursor的pointer屬性同樣是讓滑鼠顯示手型效果,但可以相容多種瀏覽器,推薦這種

.box2 a{background-color: #DBDBDB;cursor:pointer;}

cursor的crosshair屬性是讓滑鼠顯示十字型效果

.box3 a{background-color:#777777;cursor:crosshair;}

cursor的help屬性是讓滑鼠顯示問號型效果

.box4 a{background-color:#E6E6E6;cursor:help;}

cursor的wait屬性是讓滑鼠顯示等待效果,這是一種載入效果

background-color:#2DC4CB;cursor:wait;}

cursor除了以上的滑鼠游標形狀效果,還有表示不同箭頭指向的游標效果:e- resize(向右的箭頭) ,ne-resize(向右上的箭頭) ,n-resize(向上的箭頭 ),nw-resize(向左上的箭頭) ,w- resize(向左的箭頭) ,sw-resize(左下的箭頭) ,s-resize(向下的箭頭 ),se-resize(向右下的箭頭)。

以上,介紹了CSS如何?滑鼠游標形狀的變化的相關用法,希望對你有協助!更多請關注php中文網其它相關文章!

相關文章

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.