It is still necessary to disable the selection of text in certain scenarios, such as not wanting to have others copy their articles. We can solve this problem by using CSS+JS. In addition, it is pointed out here that User-select is not the official standard of the web, and that each browser provides support in the form of a private attribute.
Grammar
Formal Syntax:none | Text | All | Element
The code is as follows:
(-prefix-) User-select:none; (-prefix-) User-select:text; (-prefix-) User-select:all; (-prefix-) user-select:element;
The code is as follows:
. row-of-icons {-webkit-user-select:none;/* Chrome All/safari all */-moz-user-select:none;/* Firefox all */-ms-user-s Elect:none; /* IE + */</p> <p>/* No support for these yet,use at own risk */-o-user-select:none;user-select:none;}
IE compatibility
Currently in IE 10 and IE 10 version of the browser can use-ms-user-select this rule, but in earlier versions of IE, we can only be implemented by JavaScript to suppress the selection of text:
The code is as follows:
$ (EL). attr (' unselectable ', ' on '). CSS ({'-moz-user-select ': '-moz-none ', '-moz-user-select ': ' None ', '-o-user-select ') : ' None ', '-khtml-user-select ': ' None ',/* could also put this in a class */'-webkit-user-select ': ' None ',/* and add the C SS class here instead */'-ms-user-select ': ' None ', ' user-select ': ' None '}). bind (' Selectstart ', function () {return false;});