You can use this style to your web page element if you do not want a user to select it using pointer cursor and that content selected background blue/grey color.
CSS
.disable-user-seclect{
webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-o-user-select: none;
user-select: none;
}
This CSS code works on all major web browsers, including Chrome, Firefox, Safari, Edge, and Internet Explorer, and it prevents text from being selected when users click and drag over it. To disable text selection highlighting on specific elements, you can wrap them in a container and apply the CSS code to the container instead of the entire body
element.
Note that this code will not prevent users from copying text, but it will prevent them from visually selecting it. Additionally, keep in mind that disabling text selection can make it harder for users to copy and paste content, so use this technique judiciously.
You must be logged in to post a comment.