【发布时间】:2019-09-19 05:49:46
【问题描述】:
我有一张图片作为背景图片被入侵(如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>
有什么想法吗?
【问题讨论】:
-
我认为您应该使用
-moz-user-select: none;而不是-moz-user-select: -moz-none;。否则,我认为这应该可行。 -
PS 如果你想要一个漂亮的背景担架,请使用 bgStretcher.js 在我的网站上像梦一样工作 - 但我将它破解到我自己的版本缓存/预加载图像,因为我加载高清图像.. 和硬编码 noSelect在那里..