Home > Article > Web Front-end > How to prevent text from being selected in css (code)
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!