CSS user-select property
- Previous Page unicode-bidi
- Next Page vertical-align
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
Prevent text selection from <div> elements:
div { -webkit-user-select: none; /* Safari */ -ms-user-select: none; /* IE 10+ and Edge */ user-select: none; /* Standard syntax */ }
CSS Syntax
user-select: auto|none|text|all;
Attribute Value
Value | Description |
---|---|
auto | Default. Text can be selected if the browser allows it. |
none | Prevent text selection. |
text | Text can be selected by the user. |
all | Select text by clicking, not by double-clicking. |
Technical Details
Default Value: | auto |
---|---|
Inheritance: | No |
Animation Production: | Not supported. See also:Animation-related properties. |
Version: | CSS3 |
JavaScript Syntax: | object.style.userSelect="none" |
Browser Support
The numbers in the table indicate the first browser version that fully supports this property.
The first version of the prefix should be used according to the number specification following -webkit-, -ms-, or -moz-.
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- |
- Previous Page unicode-bidi
- Next Page vertical-align