User Select

The user-select property controls whether the user can select text.

Basic Concepts

The behavior for user-select: auto is as follows:

  • On the ::before and ::after pseudo elements, the used value is none
  • If the element is an editable element (e.g. <input>), the used value is contain
  • Otherwise, if the user-select value of the parent is all, the used value is all
  • Otherwise, if the user-select value of the parent is none, the used value is none
  • Otherwise, the used value is text

CSS Properties

user-select

Controls whether the user can select text.

  • autouse default behavior (see above)
  • nonethe text of the element and its children is not selectable
  • textthe text can be selected
  • allwhen selecting the text, select ALL of the element's text
  • containthe text can be selected, but the selection will be contained by the bounds of that element
| LIVE PREVIEW
Select all text automatically!

References