Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

user-select — controlling selection

The user-select property controls how users can select an element’s content. It does not provide copy protection.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

user-select: auto | text | none | contain | all;

user-select controls content selection. text imposes no restriction, none blocks selection starts, and all requires atomic selection, with descendant exceptions. contain confines selections started inside to the element’s boundaries; verify support.

Initially auto, its used value becomes none for ::before and ::after, contain for editable elements, then the parent’s all or none, otherwise text. The property is not inherited; this parent-dependent behavior comes from auto.

none is not copy protection. Apply it sparingly to interface elements rather than essential content. -webkit-user-select is the specification-required compatibility alias.

Examples

<!doctype html>
<meta charset="utf-8">
<title>user-select</title>
<style>
  .ordinary { user-select: text; }
  .blocked { user-select: none; }
  .atomic { user-select: all; }
</style>
<p class="ordinary">Alpha Beta Gamma</p>
<p class="blocked">Drag starts are blocked here.</p>
<p class="atomic">TOKEN-123-XYZ</p>

Result

Expected manual behavior: part of Alpha Beta Gamma can be selected; a drag started in the second paragraph does not select its text; selecting part of TOKEN-123-XYZ selects the whole token.

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources