我有一个图像作为背景图像被入侵(如图here)。我注意到,如果我将鼠标拖过它,它会选择图像,以便它不能被取消选择。我试过以下代码无济于事:防止图像和文本被选择
<style type="text/css">
html, body {
height: 100%;
margin: 0;
padding: 0;
}
img#bg {
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
}
#content {
position:relative;
z-index:1;
top:0px;
left:0px;
}
*.unselectable {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-o-user-select: none;
user-select: none;
}
</style>
任何想法?
可能重复http://stackoverflow.com/questions/826782/css-rule-to-disable-text-selection -highlighting) – kapa 2011-05-06 17:45:26
我想你应该使用'-moz-user-select:none;'而不是'-moz-user-select:-moz-none;'。否则,我认为这应该工作。 – 2011-05-06 17:49:05
PS如果你想要一个不错的背景担架使用bgStretcher.js在我的网站上工作就像一个梦 - 但我砍了它到我自己的版本缓存/ preload图像导致我加载高清图像..和硬编码noSelect在那里.. – ppumkin 2011-05-06 17:58:57