属性 user-select CSS

Definition and Usage

The user-select property specifies whether the text of an element can be selected.

In web browsers, if you double-click on text, the text will be selected or highlighted. This property is used to prevent this behavior.

See Also:

HTML DOM Reference Manual:userSelect Property

Example

Dafna koyi na <div> element:

div {
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none; /* IE 10+ and Edge */
  user-select: none; /* Standard syntax */
}

Try It Yourself

CSS Syntax

user-select: auto|none|text|all;

Property Value

Value Description
auto Dafya. Idan browser ya amince, zai iko a cikin tasiri na koyi.
none Dafna text
text Text yana da iko a cikin tasiri na mutum.
all Duba cuta don koyi, haka yadda ba a duba ba.

Rarrabawar ilimi

Dafya: auto
Yantawa: No
Animation da yin: 不支持。Ka fi gani:Properties da ke haɗuwa da gida.
Versiyon: CSS3
JavaScript na farko: object.style.userSelect="none"

Koyi browser

Tabbin da nuna sabon biliya wanda ake ganin ya koyi daga sabonin browser.

Koyi -webkit-、-ms- tso -moz- ka na gina gurin biliya.

Chrome IE / Edge Firefox Safari Opera
54.0
6.0 -webkit-
79.0
10.0 -ms-
69.0
2.0 -moz-
3.1 -webkit- 41.0
15.0 -webkit-