html - 如何在禁用的链接上获取 “not-allowed” 光标

标签 html css

我想知道如何获得 not-allowed光标在我禁用的链接上。我试图将它添加到禁用事件中,但它在那里不起作用,然后我尝试使用相同的光标事件引入悬停效果。关于如何让它发挥作用的任何想法?我在这里包含了我的代码 CSS:

.disabled {
pointer-events: none;
cursor: not-allowed;
text-decoration: none;
color: rgba(255, 255, 255, 0.25);
}

.disabled:hover {
    cursor: not-allowed;
}
和我的 HTML 在这里:
<li><a href="index.html" class="disabled">Home</a></li>

最佳答案

您必须删除 pointer-events: none;使这项工作。

body {
  background: #555;
}

.disabled {
  /* pointer-events: none; */ /* removed */
  text-decoration: none;
  color: rgba(255, 255, 255, 0.25);
}

.disabled:hover {
  cursor: not-allowed;
}
<ul>
  <li><a href="index.html" class="disabled">Home</a></li>
</ul>

关于html - 如何在禁用的链接上获取 “not-allowed” 光标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64186238/

相关文章:

javascript - CSS 中不同的元素类型可以使用相同的 ID 吗?

jquery - rails ajax URL更改

asp.net - anchor 标记在行悬停时不可见

HTML 链接在 <ul> 标签内不起作用

python - 在 Python 2.5 中解码未知 unicoding 编码的最佳方法

javascript - 分机号 : createStyleSheet problems with two classes

javascript - 随机数猜测器不适用于 Javascript

html - 显示 :inline for creating a horizontal navigation bar not working

css - 在 CSS 中插入背景图片 (Twitter Bootstrap)

HTML 表格 : Is there a good practice for specifying column widths?