css教程网 css教程网365css.cn
公告为您打开互联网世界的窗户关于本站

cursor

鼠标悬停时的指针样式。

语法
cursor: <cursor-keyword> | url(...) <x> <y>, <fallback>
常用值
pointer / default / text / not-allowed / grab / zoom-in
初始值
auto
继承
是

运行效果

示例改成别的值试试,差异一眼能看出来
查看代码
HTML
<div class="cu"><button>pointer</button><span class="na">not-allowed</span></div>
CSS
.cu { display: flex; gap: 8px; align-items: center; }
.cu button { padding: 7px 12px; border: 0; border-radius: 7px; background: #2b57ff; color: #fff; font: 600 11px/1 ui-monospace, monospace; cursor: pointer; }
.cu .na { font-size: 11px; color: #98a1b0; cursor: not-allowed; }

使用要点

  • 可点击元素一定要用 pointer,否则用户不确定能不能点。
  • 禁用态用 not-allowed,但别只靠指针表达禁用,要配合视觉与 aria-disabled。