CSS user-select property

Description

CSS user-select property tells a user which elements can be selected or how to select. This property can disable selection of the whole text or specific portions of the text.

Syntax

user-select : auto | text | none | all

Property values

autoDefault

If auto is the value of user-select for the current element, it is computed to any of the above given values such as none, all, text.

user-select: auto;

text

text value does not apply any restriction to the selection of text. And a user can select the text freely.

user-select: text;

none

none value does not allow a user to select the text i.e. it disables the selection of text.

user-select: none;

all

If a user selects a part of content of the current element, this selection must include all of the remaining content including the descendant elements (atomically).

user-select: all;

Applicable to

It applies to all elements

#CSS digger
Was this article helpful?

 

The text before the selected element.

Select the text from this box and see the effect for different values of user-select property.

The text after the selected element

×

Ctrl+D