全球防止在Firefox中的文本选择 [英] Globally prevent text selection in Firefox

查看:108
本文介绍了全球防止在Firefox中的文本选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用:

  * {
-webkit-touch-callout:none;
-webkit-user-select:none;
-khtml-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
}

转到http://jsfiddle.net/KyF5x/ ,然后点击列表下方,看到此处突出显示的文字...无法取消突出显示。重新加载页面,现在尝试ctrl + a,看到这也将突出显示文本。



上述情况不会发生在Chrome,Safari或IE 10。 p>

免责声明:我使用的是Firefox 18

解决方案

,修复是将CSS应用于单个不可选元素。但是我很想看到有人提出了一个文档范围的修复。

  li {
-webkit- touch-callout:none;
-webkit-user-select:none;
-khtml-user-select:none;
-moz-user-select:none;
-ms-user-select:none;
user-select:none;
}

请参阅:http://jsfiddle.net/KyF5x/1/



具有文档范围的不可选文本的用例在网络应用程序的域,而不是典型的网站。


I'm currently using:

*{
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

Go to http://jsfiddle.net/KyF5x/ and click below the list, see that this highlights the text... which can't be un-highlighted. Reload the page, now try ctrl+a, see that this will also highlight the text.

The above doesn't occur in Chrome, Safari or IE 10.

Disclaimer: I'm using Firefox 18

解决方案

As a temporary answer, the fix is the apply the CSS to the individual 'unselectable' elements. However i'd love to see someone come up with a document-wide fix.

li{
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

See: http://jsfiddle.net/KyF5x/1/

A use case for having document-wide unselectable text is more obvious in the domain of web apps, rather than typical websites.

这篇关于全球防止在Firefox中的文本选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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