如何组合光标:不允许和指针事件:无; [英] How to combine cursor: not-allowed and pointer-events: none;

查看:265
本文介绍了如何组合光标:不允许和指针事件:无;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何组合CSS光标:不允许和指针事件:无; 不允许出现

How can I combine CSS cursor: not-allowed and pointer-events: none; not-allowed seems not to appear

.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }
.pointer-events-none { pointer-events: none; }

<button class="cursor-default">cursor-default</button>
<button class="cursor-not-allowed">cursor-not-allowed</button>
<button class="pointer-events-none">pointer-events-none</button>
<button class="cursor-not-allowed pointer-events-none">cursor-not-allowed + pointer-events-none</button>

小样本,请看一下第四个按钮 光标:不允许,没有看过按钮,而是显示了一个看似的图标.

Small sample, please have a look a the forth button cursor: not-allowed did'nt look the button, but show an looked icon.

推荐答案

您无法执行此操作,因为pointer-events: none;禁用了所有鼠标功能,但是您可以做一些技巧,并用div包装按钮,然后使用cursor: not-allowed;.

you can't do this because pointer-events: none; disable all mouse functions, but you can do a trick and wrap your button with a div then use cursor: not-allowed; on this.

.pointer-events-none {
    pointer-events: none;
}

.wrapper {
    cursor: not-allowed;
}

<div class="wrapper">
<button class="pointer-events-none">Some Text</button>
</div>

在使用"pointer-events"时添加CSS游标属性:无""

这篇关于如何组合光标:不允许和指针事件:无;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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