Of course, one can disable text selection on an HTML page by using CSS. Here is a way you can dot it:
1. Using CSS
The user-select property stops the user from selecting text. Here's how you can use it:
.unselectable {
user-select: none;
-webkit-user-select: none; /* For Chrome, Safari, and Edge */
-moz-user-select: none; /* For Firefox */
-ms-user-select: none; /* For Internet Explorer/Edge */
}
Apply this class to any element you want to make unselectable:
<p class="unselectable">This text cannot be selected.</p>
Important Note
Please understand that this does not give perfect content protection. To get to the text part users can use developer tools or open page source. Limit its usage because it could have a negative side depending on the users.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Of course, one can disable text selection on an HTML page by using CSS. Here is a way you can dot it:
1. Using CSS
The user-select property stops the user from selecting text. Here's how you can use it:
Apply this class to any element you want to make unselectable:
Important Note
Please understand that this does not give perfect content protection. To get to the text part users can use developer tools or open page source. Limit its usage because it could have a negative side depending on the users.