html中禁止鼠标选中文本

  • 时间:
  • 来源:互联网
原文链接:https://blog.csdn.net/weixin_40687883/article/details/90482159

<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>user-select</title>
</head>
<style>
    .test {
        padding: 10px;
        -webkit-user-select: none;
        -moz-user-select: none;
        -o-user-select: none;
        user-select: none;
        background: #eee;
    }
</style>
 
<body>
    <div class="test" onselectstart="return false;" unselectable="on">禁止选中文本内容</div>
</body>
 
</html>

 

本文链接http://element-ui.cn/news/show-96.aspx