How to disable text selection using CSS

Learn how to disable text selection using CSS propertiesuser-select

By default, the browser allows us to use the keyboard, press the cmd-A combination on the Mac or select the text in the browser on the mouse.

How can I disable it so that the web page behaves more like an application and not like a document?

useuser-select: none;CSS rules.

You need to use the browser prefix, for examplehttps://caniuse.com/#feat=user-select-nonetell us:

-webkit-touch-callout: none;
  -webkit-user-select: none;
   -khtml-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;

One thing I sometimes use is to make all application interfaces unavailable to select appsuser-select: none;On the body element, you can then use the following command to re-enable it on a specific element:

user-select: text;

Download mine for freeCSS Manual


More CSS tutorials: