How to set text in css to be read-only and non-copyable: You can use the user-select attribute to set it, such as [user-select: none;]. The user-select attribute is used to set or retrieve whether the user is allowed to select text. None means that the text cannot be selected.
The operating environment of this tutorial: windows7 system, css3 version. This method is suitable for all brands of computers.
css setting text cannot be copied and read-only
Related attributes:
The user-select attribute sets or retrieves whether the user is allowed to select text.
(Learning video sharing: css video tutorial)
Grammar:
user-select:none |text| all | element
Attribute 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
Example:
-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属性 */
Related recommendations: CSS tutorial
The above is the detailed content of How to set text in css to be read-only and not copyable. For more information, please follow other related articles on the PHP Chinese website!