CSS properties - user-select

revision:


user-select property

- specifies whether the text of an element can be selected.

In web browsers, if you double-click on some text it will be selected/highlighted. This property can be used to prevent this.

CSS syntax : user-select: auto | none | text | all;

Property values:

auto : default. Text can be selected if the browser allows it

none : prevent text selection

text : the text can be selected by the user

all : text selection is made with one click instead of a double-click

JavaScript syntax: object.style.userSelect="none"

example: user-select property
The text of this div element cannot be selected. If you double-click me, my text will not be highlighted.
code:
                    <div>
                        <div class="Text-A">The text of this div element cannot be selected. If you double-click me, 
                        my text will not be highlighted.</div>
                    </div>
                    <style>
                    div.Text-A { -webkit-user-select: none; /* Safari */ -ms-user-select: none; /* IE 10 and IE 11 */ 
                        user-select: none; /* Standard syntax */}
                    </style>