Skilled in SEO, content writing, and digital marketing. Completed several years of working in many organizations including multinational companies.
I love to learn new things in life that keep me motivated.
To make certain text not selectable with CSS, you can use the user-select property with the value
none. Here's an example:
.not-selectable {
user-select: none;
}
In this example, any text within an element with the class not-selectable will not be selectable by the user. This is particularly useful when you want to prevent users from copying or highlighting certain parts of the text, such as copyright notices or disclaimers.
Note that the user-select property is not supported in all browsers, particularly older versions of Internet Explorer. If you need to ensure cross-browser compatibility, you may want to use JavaScript instead to prevent text selection.
Join MindStick Community
You need to log in or register to vote on answers or questions.
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.
To make certain text not selectable with CSS, you can use the user-select property with the value none. Here's an example:
In this example, any text within an element with the class not-selectable will not be selectable by the user. This is particularly useful when you want to prevent users from copying or highlighting certain parts of the text, such as copyright notices or disclaimers.
Note that the user-select property is not supported in all browsers, particularly older versions of Internet Explorer. If you need to ensure cross-browser compatibility, you may want to use JavaScript instead to prevent text selection.