twitter-bootstrap bootstrap 4,光标悬停在按钮上时不会改变,但会在锚点上改变

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43115032/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 00:43:56  来源:igfitidea点击:

bootstrap 4, cursor doesn't change when hovering over a button but does on anchors

htmlcsstwitter-bootstrapbootstrap-4twitter-bootstrap-4

提问by InitLipton

I'm using bootstrap 4 alpha, and it seems that the cursor on buttons has been removed for buttons but not anchor tags. example on the bootstrap site.

我正在使用 bootstrap 4 alpha,似乎按钮上的光标已被删除,而不是锚标签。引导站点上的示例。

https://v4-alpha.getbootstrap.com/components/buttons/

https://v4-alpha.getbootstrap.com/components/buttons/

In my application i have a form, with two buttons, one is to post to the form and the other is to redirec to another page. The input doesn't display the cursor but the anchor does. I know i can create a custom css class, but is there a reason why this has been removed or is it an issue with the current alpha version?

在我的应用程序中,我有一个带有两个按钮的表单,一个是发布到表单,另一个是重定向到另一个页面。输入不显示光标,但锚点显示。我知道我可以创建一个自定义 css 类,但是是否有原因将其删除,或者是当前 alpha 版本的问题?

<input type="submit" value="Sign In" class="btn btn-primary" />
<a role="button" href="@Url.Action("Register", "Account")" class="btn btn-secondary">Register Now</a>

回答by Ravenous

Here's your explanation - https://medium.com/simple-human/buttons-shouldnt-have-a-hand-cursor-b11e99ca374b

这是你的解释 - https://medium.com/simple-human/buttons-shouldnt-have-a-hand-cursor-b11e99ca374b

I'm not sure Bootstrap v4 adds that on anchor elements either (can't check at the moment), but what I do know for sure is that browsers add the cursor by default whenever a link has the hrefattribute.

我不确定 Bootstrap v4 是否在锚元素上添加了它(目前无法检查),但我可以肯定的是,只要链接具有该href属性,浏览器就会默认添加光标。

LE - The stable release was launched a week ago and it now features

LE - 一周前发布了稳定版本,现在具有

.btn:not(:disabled):not(.disabled) {
    cursor: pointer;
}

Announcement at https://blog.getbootstrap.com/2018/01/18/bootstrap-4/

https://blog.getbootstrap.com/2018/01/18/bootstrap-4/公告

回答by Jababekz

add class="btn"

添加 class="btn"

it causes the cursor to be pointer

它导致光标成为指针