2017-10-06 29 views
1

比方说,我有我的网页上下面的简单结构:如何使网页元素没有突出的选择所有命令

<div class="logo"> 
    <img src="logo.jpeg" alt="logo"/> 
</div> 

当预览我的网页在Chrome打cmd+A(全选),图像块变得突出。这里有一个直观例子:

enter image description here

我怎样才能防止所选元素不突出也是这样吗?

+1

的可能的复制[有没有一种方法,使一个DIV不可选择?(https://stackoverflow.com/questions/924916/is-there-a-way-to- make-a-div-unselectable) –

回答

1

.user-select-none { 
 
    user-select: none; 
 
    -moz-user-select: none; 
 
    -khtml-user-select: none; 
 
    -webkit-user-select: none; 
 
    -o-user-select: none; 
 
}
<div class="user-select-none"> 
 
    You can not drag this. 
 
</div> 
 
<div class="user-select-on"> 
 
    You can drag this. 
 
</div>

+0

这对Windows上的Ctrl + A非常有用,但鼠标选择如何。 –

相关问题