gpt4 book ai didi

css - :active css class not working correctly to modify cursor property

转载 作者:行者123 更新时间:2023-12-05 08:00:53 25 4
gpt4 key购买 nike

我正在尝试修改光标,以便在我拖动 (:active) div/link 时它会发生变化。

但是我不明白我做错了什么,因为背景属性工作正常。

div {cursor:crosshair;}
div:active {cursor:wait;}
a {cursor:crosshair;}
a:active {cursor:wait;}

据我所知,当鼠标处于事件状态(拖动)时,应该应用 :active 属性。在这种情况下,将应用背景/颜色黄色属性,但不会应用光标属性(等待)。

Fiddle

最佳答案

cursor 确实更改为 wait 但在拖动时 user-select 属性也会生效,这会更改 cursor 默认为 text

您可以通过以下方式禁用它:

div, a {
-moz-user-select: -moz-all;
-webkit-user-select: all;
-ms-user-select: all;
user-select: all;
}

w3c 属性目前还没有被主流浏览器实现。所以你必须使用供应商前缀。此解决方案的一个主要缺点是您将无法再选择元素 divp 中的内容。它主要用于使 button 不可选择。

Demo

但它仍然无法在 a 上运行。可能是其他一些东西压倒了它。也许是 HTTP 请求 处理程序?我不知道,我现在只是在抛出愚蠢的想法。

+user-select (W3C)

关于css - :active css class not working correctly to modify cursor property,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16850260/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com