css implements the function of prohibiting page text from being selected

王林
Release: 2020-09-30 16:40:34
forward
2244 people have browsed it

css implements the function of prohibiting page text from being selected

Use css to realize that page text cannot be selected

(recommended tutorial:CSS tutorial)

.cannotselect { -webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
Copy after login

css introduction

user-select

Description

Control whether the selection can be selected.

This feature is non-standard , please try not to use it in a production environment!

Formal syntax: none | text | all | element
Copy after login

none: The text within the element and its child elements will not be selected
text: The user can select the text
all: In an HTML editor, when double-clicking a child element or context , then the top-level element containing the child element will also be selected.
element: Valid in Firefox and IE. Enables selection to start within the element; however, the selection will be contained by the bounds of that element.

Browser Compatibility

css implements the function of prohibiting page text from being selected

-webkit-touch-callout

Description

This CSS property disables the default callout display. The callout refers to appearing when an element is touched and held. tips.

When you hold down a target element on iOS, Safari will display a callout message about the link. The webkit-touch-callout attribute allows disabling this behavior.

-The webkit-touch-callout attribute was first implemented on iOS 2.0 and was later added to WebKit

Allowed values

default: This value indicates that the default callout is displayed
none: This value indicates that callout is disabled

Browser compatibility

css implements the function of prohibiting page text from being selected

The above is the detailed content of css implements the function of prohibiting page text from being selected. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!