Home  >  Article  >  Web Front-end  >  How to prevent text from being selected in css (code)

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

不言
不言Original
2018-08-28 11:20:561607browse

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>

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!

Statement:
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

Related articles

See more