Is there a way to make text unselectable on an HTML page?
Is there a way to make text unselectable on an HTML page?
387
27-Apr-2023
Updated on 09-Jan-2025
Khushi Singh
09-Jan-2025Of 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.