当用户将鼠标悬停在列表项上时,如何使光标移动? [英] How can I make the cursor a hand when a user hovers over a list item?

查看:193
本文介绍了当用户将鼠标悬停在列表项上时,如何使光标移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列表,我有一个项目的点击处理程序:

I've got a list, and I have a click handler for its items:

<ul>
  <li>foo</li>
  <li>goo</li>
</ul>

如何将鼠标指针变为手形指针(就像将鼠标悬停在按钮上一样)?

How can I change the mouse pointer into a hand pointer (like when hovering over a button)? Right now the pointer turns into a text selection pointer when I hover over the list items.

推荐答案

编辑:正如人们已经提到的,时间的流逝,你现在可以安全地使用:

In light of the passage of time, as people have mentioned, you can now safely just use:

li { cursor: pointer; }

原始答案

实际上,为了扩展以前的答案,不同的浏览器使用不同的名称。

Actually to expand on the previous answers, different browsers use different names.

li { cursor: pointer; cursor: hand; }

会在全部的情况下覆盖您。

这篇关于当用户将鼠标悬停在列表项上时,如何使光标移动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆