How to disable text select with CSS?

Sometimes, we want to disable text select with CSS.

How to disable text select, we’ll look at in this article with CSS.

How to disable text select with CSS?

To disable text select with, we set the user-select style to none with CSS.
For instance, we can write

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

the most common browser on the body element is to set the user-select style to none to disable selection on the text on the page.

Conclusion

To disable text select, we set the user-select style to none with CSS.

Leave a Reply