Learn how to disable textual content choice highlighting in CSS

0
9
Adv1


Adv2

If you want to disable the textual content choice highlighting that’s enabled by default on all browsers, then you are able to do this:

user-select: none;

In case you are involved about cross-browser help, then use this class:

.noselect {
  -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none; /* Safari */
     -khtml-user-select: none; /* Konqueror HTML */
       -moz-user-select: none; /* Outdated variations of Firefox */
        -ms-user-select: none; /* Web Explorer/Edge */
            user-select: none; /* Non-prefixed model, presently
                                  supported by Chrome, Edge, Opera and Firefox */
}

You possibly can then use it like this:

<p>
  Selectable textual content.
</p>
<p class="noselect">
  Unselectable textual content.
</p>
Adv3