How to make Unselectable text from CSS

0
204

You sometimes need to add some text that you do not wish to be selected from the browser.

Of course you can not actually make something that will enable you to protect your data.. as this is something public and you can not do much about it because an experienced user can always get the source code

But you can make that normal user can not select some text you wish. How? This is simple. The following is the HTML code

<p class="unselectable">You can't select me! Na na na!</p>

The next code is CSS:

.unselectable {
  user-select: none;
}

LEAVE A REPLY

Please enter your comment!
Please enter your name here