I have the following CSS:
我有以下CSS:
* {
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}
This works in every browser except for in IE, why is this? The selection of text looks really ugly because my menus are created from text and CSS... any ideas?
这在每个浏览器中都有效,除了IE,为什么?文本的选择看起来很难看,因为我的菜单是由文本和CSS创建的…什么好主意吗?
2 个解决方案
#1
22
You can use Javascript and do:
您可以使用Javascript和do:
document.onselectstart = function() { return false; }
document.onmousedown = function() { return false; }
The first one works for IE and the second one does Mozilla-based browsers.
第一个是IE,第二个是基于mozilla的浏览器。
#2
1
This question has been answered:
这个问题已经回答了:
How to disable text selection highlighting using CSS?
如何禁用使用CSS的文本选择?
#1
22
You can use Javascript and do:
您可以使用Javascript和do:
document.onselectstart = function() { return false; }
document.onmousedown = function() { return false; }
The first one works for IE and the second one does Mozilla-based browsers.
第一个是IE,第二个是基于mozilla的浏览器。
#2
1
This question has been answered:
这个问题已经回答了:
How to disable text selection highlighting using CSS?
如何禁用使用CSS的文本选择?