The way to prohibit copying of css is to set non-copyable css code through the [user-select] attribute, the syntax is [user-select: none | text | all | element].
The operating environment of this tutorial: windows7 system, css3 version, DELL G3 computer.
How to prohibit copying in css:
Set non-copyable css code through the user-select attribute:
-moz-user-select:none; /* Firefox私有属性 */ -webkit-user-select:none; /* WebKit内核私有属性 */ -ms-user-select:none; /* IE私有属性(IE10及以后) */ -khtml-user-select:none; /* KHTML内核私有属性 */ -o-user-select:none; /* Opera私有属性 */ user-select:none; /* CSS3属性 */
IE6-9 does not support this attribute , but supports using the label attribute onselectstart="return false;" to achieve the effect of user-select:none.
user-select
Syntax:
user-select:none |text| all | element
Default value: text
Applies to: except Replace all elements except the element
Inheritance: None
Animation: No
Calculated value: Specified value
Value:
none: Text cannot be selected
text: Text can be selected
all: All content can be selected when taken as a whole. If you double-click or contextually click on a child element, the selected part will be the highest ancestor element tracing back from that child element.
element: Text can be selected, but the selection range is constrained by the element boundary
Related learning recommendations:css tutorial
The above is the detailed content of How to prohibit copying in css. For more information, please follow other related articles on the PHP Chinese website!