htmlHow to set text that cannot be selected: 1. Create an HTML page file; 2. Set the css style to "user-seletct: none;-webkit-user-seletct: none;-moz-user-seletct : none;" will do.
The operating environment of this article: windows7 system, HTML5 version, DELL G3 computer
html How to set text so that it cannot be selected?
Methods to control the content of HTML pages that cannot be selected
There are two methods
One: css method
user-seletct: none; -webkit-user-seletct: none; -moz-user-seletct: none; -ms-user-seletct: none;
none: The content cannot be selected
text: Content can be selected
2: js method
document.body.onselectstart = function(){ return false; }
returns false, cannot be selected
returns true, can be selected
Recommended learning : "HTML5 video tutorial"
The above is the detailed content of How to set text in html so that it cannot be selected. For more information, please follow other related articles on the PHP Chinese website!