css禁止文字被选择

 

 

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>css禁止文字被选择</title>
    <style type="text/css">
    .m-no-select {
        -webkit-touch-callout: none;
        /* iOS Safari */
        -webkit-user-select: none;
        /* Chrome/Safari/Opera */
        -khtml-user-select: none;
        /* Konqueror */
        -moz-user-select: none;
        /* Firefox */
        -ms-user-select: none;
        /* Internet Explorer/Edge */
        user-select: none;
        /* Non-prefixed version, currently

not supported by any browser */
    }
    </style>
</head>
<div>可以选择</div>
<div class="m-no-select">不可以选择</div>

<body>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script type="text/javascript">
    </script>
</body>

</html>

 

 

 

 

posted @ 2018-08-23 17:14  徐同保  阅读(3092)  评论(0编辑  收藏  举报