2013年9月25日 星期三

HTML滑鼠游標大全

我們有時候可能希望當使用者滑鼠游標移到某張圖片或是某個元素時會有不同的游標圖示,
這時候就可透過cursor這個屬性來設定游標的圖示,我挑了幾個比較常用到的游標圖示,如以下的程式碼:


  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <style type="text/css">
  6.            div {
  7.                display: inline-block;
  8. border: 2px solid red;
  9. width: 120px;
  10. height: 120px;
  11. vertical-align:bottom;
  12.            }
  13.         </style>
  14.     </head>

  15.     <body>
  16.         <div style="cursor:col-resize;">水平拖動線</div>
  17.         <div style="cursor:crosshair;">十字線</div>
  18.         <div style="cursor:move;">代表移動十字箭頭</div>
  19.         <div style="cursor:help;">帶問號的箭頭</div>
  20.         <div style="cursor:not-allowed">禁止</div>
  21.         <div style="cursor:pointer;">手型</div>
  22.         <div style="cursor:progress;">帶沙漏的箭頭</div>
  23.         <div style="cursor:row-resize;">垂直拖動線</div>
  24.         <div style="cursor:text;">水平文字編輯</div>
  25.         <div style="cursor:vertical-text;">垂直文字編輯</div>
  26.         <div style="cursor:wait;">沙漏</div>
  27.         <div style="cursor:n-resize;">可向上拖動的</div>
  28.         <div style="cursor:ne-resize;">上、右可拖動的</div>
  29.         <div style="cursor:se-resize;">下、右可拖動的</div>
  30.     </body>
  31. </html>

沒有留言:

張貼留言