CSS指针形状属性cursor

CSS有一个属性cursor,它可以改变指针形状

最长的无非就是给节点加上小手的形状了

# div {
  width: 300px;
  height: 300px;
  cursor: pointer;
  background: red;
}

指针有很多种,看看来自W3C这个例子就知道了

.alias {cursor: alias;}
.all-scroll {cursor: all-scroll;}
.auto {cursor: auto;}
.cell {cursor: cell;}
.context-menu {cursor: context-menu;}
.col-resize {cursor: col-resize;}
.copy {cursor: copy;}
.crosshair {cursor: crosshair;}
.default {cursor: default;}
.e-resize {cursor: e-resize;}
.ew-resize {cursor: ew-resize;}
.grab {cursor: grab;}
.grabbing {cursor: grabbing;}
.help {cursor: help;}
.move {cursor: move;}
.n-resize {cursor: n-resize;}
.ne-resize {cursor: ne-resize;}
.nesw-resize {cursor: nesw-resize;}
.ns-resize {cursor: ns-resize;}
.nw-resize {cursor: nw-resize;}
.nwse-resize {cursor: nwse-resize;}
.no-drop {cursor: no-drop;}
.none {cursor: none;}
.not-allowed {cursor: not-allowed;}
.pointer {cursor: pointer;}
.progress {cursor: progress;}
.row-resize {cursor: row-resize;}
.s-resize {cursor: s-resize;}
.se-resize {cursor: se-resize;}
.sw-resize {cursor: sw-resize;}
.text {cursor: text;}
.url {cursor: url(myBall.cur),auto;}
.w-resize {cursor: w-resize;}
.wait {cursor: wait;}
.zoom-in {cursor: zoom-in;}
.zoom-out {cursor: zoom-out;}

每一个指针长什么样只能你一个个去试一试才知道了,cursor毕竟是基于操作系统的图标模型,不通的操作系统可能有不一样的效果,这点要注意

分享

TITLE: CSS指针形状属性cursor

LINK: https://www.qttc.net/173-css-cursor.html

NOTE: 原创内容,转载请注明出自琼台博客