CSS禁止鼠标左键移动选中文本

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>CSS禁止鼠标左键移动选中文本</title>
    <meta charset="utf-8" />
    <style type="text/css">
        /*禁用类user-select 左键移动选中文本*/
        .user-select {
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            -khtml-user-select: none;
            user-select: none;
        }

        /*启动类user-select 下所有p标签左键移动选中文本*/
        .user-select p{
            -webkit-user-select: text;
            -moz-user-select: text;
            -ms-user-select: text;
            -khtml-user-select: text;
            user-select: text;
        }
    </style>
</head>
<body class="user-select">
    罗分明网络博客欢迎你<br />
    www.luofenming.com<br />
    <p>
        罗分明网络博客欢迎你<br/>
        ewfqwe罗分明网络博客欢迎你fqwef<br />
        www.luofenming.com<br />
    </p>
    www.luofenming.com<br />
    www.luofenming.com<br />
</body>
</html>

评论