How to prevent text from being selected in css (code)

不言
Release: 2018-08-28 11:20:56
Original
1619 people have browsed it

The content of this article is about how to prevent text from being selected in CSS (code). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

<!DOCTYPE html>
<html>
 
<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>不可以选择</div>
 
<body>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script type="text/javascript">
    </script>
</body>
 
</html>
Copy after login

Related recommendations:

How to prohibit selected text in CSS_html/css_WEB-ITnose

Prohibition of selected text on web pages Text is selected_html/css_WEB-ITnose

The above is the detailed content of How to prevent text from being selected in css (code). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template