"用户选择:无"和Firefox中的奇怪行为 [英] "user-select: none" and strange behaviour in Firefox
问题描述
我试图阻止Firefox中的某些(但不是所有元素)文本突出显示。请考虑以下内容:
I am trying to prevent text highlighting in Firefox for some, but not all elements on the page. Consider the following:
<div style="-moz-user-select: none;">
I cannot be highlighted
<div style="-moz-user-select: text;">
I should be highlightable, but am not.
</div>
</div>
根据我的理解,使用上面的css规则,内部div的文本应该是可突出的。然而这似乎不工作。在实践中,文本中不能突出显示。
As I understand it, using the above css rules, the text of the inner div should be highlightable. However this does not appear to work. In practice none of the text can be highlighted.
我想知道我是否做错了什么?如果没有,是否有人知道这种情况的解决方法?
I am wondering if I am doing something wrong? If not, does anyone know of a workaround for this situation?
谢谢!
使用备用...
-webkit-user-select: none;
...在上述示例中,在webkit浏览器中工作正常
...in the above example works just fine in webkit browsers
推荐答案
替换
<div style="-moz-user-select: none;">
<div style="-moz-user-select: -moz-none;">
-moz-user-select 属性的moz-user-selectrel =nofollow noreferrer> description 说明 -moz -none
表示不能选择元素和子元素的文本,但可以使用 -moz-user-select:text; / code>
The description of the -moz-user-select
property states that -moz-none
means that the text of the element and sub-elements cannot be selected, but selection can be enabled on sub-elements using -moz-user-select: text;
这篇关于"用户选择:无"和Firefox中的奇怪行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!