Sometimes, we want to disable text select with CSS.
In this article, we’ll look at how to disable text select with CSS.
How to disable text select with CSS?
To disable text select with CSS, we set the user-select
style to none
.
For instance, we 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;
}
to set the user-select
style to none
for the most common browsers on the body element to disable selection on the text on the page.
Conclusion
To disable text select with CSS, we set the user-select
style to none
.