【问题标题】:Is there a way for mouse to completely ignore an html element? [duplicate]有没有办法让鼠标完全忽略一个 html 元素? [复制]
【发布时间】:2012-01-31 05:54:02
【问题描述】:

可能重复:
css rule to disable text selection highlighting

在我的主页上,我有一个脚本,它在我的主页顶部显示了一个时钟。我不喜欢我可以用鼠标选择这个时钟,看图片。

所以我想知道是否有办法完全防止 html 元素被鼠标选中。

【问题讨论】:

    标签: html css


    【解决方案1】:

    CSS 可以做到这一点。

    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -o-user-select: none;
    user-select: none;
    

    【讨论】:

    • CSS XD 的简单和强大
    • 还有一件事...为什么有 5 行 :S ???
    • 每个浏览器引擎(Chrome、Safari = webkit、Chrome 1.0 = khtml、Firefox = moz、Opera = o)一个,一个给正确实现 CSS3 规范的人一个。
    • @Tom - 所以最后一个已经过时了? :)
    猜你喜欢
    • 1970-01-01
    • 2011-10-15
    • 1970-01-01
    • 2023-03-05
    • 2020-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-20
    相关资源
    最近更新 更多