css - 如何更改 Bootstrap 4 中禁用的 <button> 或 <a> 的光标?

标签 css bootstrap-4

如何在 buttonacursor: not-allowed>?我尝试了以下方法:

.not-allowed {
     pointer-events: auto! important;
     cursor: not-allowed! important;
}

我的按钮是这样的:

<a class="btn btn-primary btn-lg disabled not-allowed" href="https://www.example.com" role="button">Test</a>

如果没有激活指针事件,则无法更改光标。但是如果 pointer-events: autobuttona 是可点击的。如果 pointer-events: none 光标不会改变。

请帮助我,我绝望了!

最佳答案

这实际上是一个bug在 Bootstrap 中

建议的解决方案:

button:disabled {
  cursor: not-allowed;
  pointer-events: all !important;
}

或者如果你有这种结构:

<li class="disabled">
  <a href="#">My Link</a>
</li>

然后

li.disabled {
  cursor: not-allowed;
}
li.disabled a {
  pointer-events: none;
}

关于css - 如何更改 Bootstrap 4 中禁用的 <button> 或 <a> 的光标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50349017/

相关文章:

twitter-bootstrap - 在 Bootstrap 按钮文档中,按钮之间的边距是如何实现的

html - 仅使用 css 调整多个 div 的高度(响应式设计)

jquery 悬停/更改 css 属性帮助

javascript - Knockout.js 单击更改(不切换)css 类

javascript - 滚动到表格内的特定位置

css - 共享布局 View 不适用于 ASP.NET Core 2.1 中的所有 View

javascript - Bootstrap 4 - 模态视频重新加载

html - 使用 CSS3 或图像的圆 Angular ?

css - 替代可见性 :hidden

css - 我怎样才能只继承 Bootstrap 预定义类的几个属性?