CSS: user-select

By Xah Lee. Date: . Last updated: .

Prevent text selection.

Note, this does not work for right-click menu.

body {user-select: none;}

Note: does not work in Safari nor Firefox as of 2019-02-26

Possible values:

user-select:auto
inital value.
user-select:none
not selectable.
user-select:text
selectable.
user-select:contain
(not much used)
user-select:all
(not much used)

Prevent Right Click

to prevent right click, use this JavaScript

document.addEventListener ('contextmenu', (x => x.preventDefault ()) , false);

JS in Depth
XAH  BUY NOW

CSS

Basics

Color

Font

Text Decoration

Box Model

Box Decoration

Layout

Layers

Transform/Animation

Line Wrap

Misc