css禁止文字被选择

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xutongbao/article/details/81984553
<!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>

猜你喜欢

转载自blog.csdn.net/xutongbao/article/details/81984553