user-select

Controls whether the user can select text within an element. It is often used to prevent text selection on UI elements like buttons or icons.

It is documented as part of the CSS Basic User Interface specification.

/* Usage Example */
.unselectable {
  user-select: none;
  /* prevents accidental text selection on UI components */
}

/* Syntax */
user-select: auto;
user-select: text;
user-select: none;
user-select: all;

/* Global values */
user-select: inherit;
user-select: initial;
user-select: revert;
user-select: revert-layer;
user-select: unset;
Widely available Since 2015 95% global usage

This feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.

54+
69+
3+
79+
Kinsta

Your first month is free

Managed WordPress hosting for faster sites.

Learn more

New CSS drops.

Join 600+ readers who've survived clearfix hacks.

ESC