将鼠标悬停在< button>按钮上时,如何使光标变为手形标签 [英] How to get the cursor to change to the hand when hovering a <button> tag

查看:382
本文介绍了将鼠标悬停在< button>按钮上时,如何使光标变为手形标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在查看我的网站时,光标只会变为带有<a>标签的戴手套的手,而不是变为<button>标签的戴手套的手.有这个原因吗?

When viewing my site, the cursor only changes to the gloved hand for <a> tags, not <button> tags. Is there a reason for this?

这是我的代码(在css3中,按钮标签的ID为#more).

Here is my code (the button tags have an id of #more in css3).

 #more {
    background:none;
    border:none;
    color:#FFF;
    font-family:Verdana, Geneva, sans-serif;
}

推荐答案

请参阅: https://developer.mozilla.org/zh-CN/docs/Web/CSS/光标

所以您需要添加:cursor:pointer;

在您的情况下使用:

#more {
  background:none;
  border:none;
  color:#FFF;
  font-family:Verdana, Geneva, sans-serif;
  cursor:pointer;
}

这会将光标应用于ID为更多"的元素(只能使用一次).因此,在您的HTML中使用

This will apply the curser to the element with the ID "more" (can be only used once). So in your HTML use

<input type="button" id="more" />

如果您想将其应用于多个按钮,则有多种可能性:

If you want to apply this to more than one button then you have more than one possibility:

使用CLASS

.more {
  background:none;
  border:none;
  color:#FFF;
  font-family:Verdana, Geneva, sans-serif;
  cursor:pointer;
}

并在您的HTML中使用

and in your HTML use

<input type="button" class="more" value="first" />
<input type="button" class="more" value="second" />

应用于html上下文:

input[type=button] {
  background:none;
  border:none;
  color:#FFF;
  font-family:Verdana, Geneva, sans-serif;
  cursor:pointer;
}

并在您的HTML中使用

and in your HTML use

<input type="button" value="first" />
<input type="button" value="second" />

这篇关于将鼠标悬停在&lt; button&gt;按钮上时,如何使光标变为手形标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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