CSS user-select Property

❮ Previous Reference Next ❯


.example1 {
  user-select: auto;

.example2 {
  user-select: none;

Try to select this text


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
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.


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:

  • On the ::before and ::after pseudo elements, the used value is none
  • If the element is an editable element, the used value is contain
  • Otherwise, if the used value of user-select on the parent of this element is all, the used value is all
  • Otherwise, if the used value of user-select on the parent of this element is none, the used value is none
  • Otherwise, the used value is text
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;
❮ Previous Reference Next ❯