CSS user-select Property
Example
.example1 {
user-select: auto;
}
.example2 {
user-select: none;
}
Try to select this text
Meaning
The user-select property controls whether the user can select text.
This doesn't have any effect on content loaded as part of a browser's user interface (its chrome), except in textboxes.
Default value: | auto |
Inherited: | No |
Animatable: | No |
Version: | CSS3 |
JavaScript syntax: |
|
Standard Syntax
user-select: auto|none|text|all|contain|initial|inherit|revert|revert-layer|unset;
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Status
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
none | It prevent text selection. |
auto | This is default value. Text can be selected if the browser allows it.
The used value of auto is determined as follows:
|
text | The text can be selected by the user. |
all | The content of the element shall be selected atomically: If a selection would contain part of the element, then the selection must contain the entire element including all its descendants. If a double-click or context-click occurred in sub-elements, the highest ancestor with this value will be selected. |
contain | Enables selection to start within the element; however, the selection will be contained by the bounds of that element. |
initial | Sets this property to its default value. |
inherit | If specified, the associated element takes the computed value of its parent element animation-delay property. |
revert | Reverts the cascaded value of the property from its current value to the value the property |
revert-layer | Rollback styles to the ones specified in previous cascade layers. |
unset | Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. |
Default CSS Property Values
selectors {
user-select: auto;
}