Home >Web Front-end >CSS Tutorial >How to set text in css to be read-only and not copyable

How to set text in css to be read-only and not copyable

王林
王林Original
2020-11-19 11:15:474085browse

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.

How to set text in css to be read-only and not copyable

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn