我有一个列表,并且有一个点击处理程序:
<ul>
<li>foo</li>
<li>goo</li>
</ul>
如何将鼠标指针更改为手指针(如悬停在按钮上)?现在,当我将鼠标悬停在列表项上时,指针变成了文本选择指针。
我有一个列表,并且有一个点击处理程序:
<ul>
<li>foo</li>
<li>goo</li>
</ul>
如何将鼠标指针更改为手指针(如悬停在按钮上)?现在,当我将鼠标悬停在列表项上时,指针变成了文本选择指针。
当前回答
仅为完整起见:
cursor: -webkit-grab;
它还提供了一只手,当移动图像的视图时,你会知道这只手。
如果您想使用jQuery和mousedown模拟抓取行为,这非常有用。
其他回答
<style>
.para{
color: black;
}
.para:hover{
cursor: pointer;
color: blue;
}
</style>
<div class="para">
在上面的HTML代码中,[:hover]用于指示以下样式只能应用于悬停或将鼠标光标保持在上面。
CSS中有几种类型的游标:
查看光标类型的以下代码:
<style>
.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: -webkit-grab; cursor: grab;}
.grabbing {cursor: -webkit-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;}
</style>
单击以下链接以查看光标属性的操作方式:
https://www.w3schools.com/cssref/tryit.asp?filename=trycss_cursor
您不需要jQuery,只需使用以下CSS内容:
li {cursor: pointer}
瞧!方便的
随着时间的推移,正如人们所提到的,您现在可以安全地使用:
li { cursor: pointer; }
对于基本手符号:
Try
cursor: pointer
如果您想要一个手形符号,如拖动某个项目并将其放下,请尝试:
cursor: grab
Use
cursor: pointer;
cursor: hand;
如果你想要一个跨浏览器的结果!