代码之家  ›  专栏  ›  技术社区  ›  user4420255

如何组合游标:不允许和指针事件:无;[副本]

  •  60
  • user4420255  · 技术社区  · 7 年前

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

    .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>

    小样品,请看第四个按钮 光标:不允许未查看按钮,但显示已查看的图标。

    1 回复  |  直到 3 年前
        1
  •  114
  •   Pedram Neo M Hacker    7 年前

    你不能这么做,因为 pointer-events: none; 禁用所有鼠标功能,但你可以做一个技巧,用 div 然后使用 cursor: not-allowed; 关于这个。

    .pointer-events-none {
        pointer-events: none;
    }
    
    .wrapper {
        cursor: not-allowed;
    }
    <div class="wrapper">
    <button class="pointer-events-none">Some Text</button>
    </div>

    Add CSS cursor property when using "pointer-events: none"