让html中的文字不可被选中

css代码:

.unselectable {
    
    
    -moz-user-select: none;
    -khtml-user-select: none;
    -webkit-user-select: none;
    -o-user-select: none;
    user-select: none;
}

div中引用(可以body标签中使用):

<div class="unselectable">div内容</div>

猜你喜欢

转载自blog.csdn.net/qq_38152400/article/details/111308904