You are currently viewing How to Disable Text Selection in CSS | Explained
  • Post category:CSS

How to Disable Text Selection in CSS | Explained

How to Disable Text Selection

In this article, we will discuss how to disable text selection in CSS. To disable text selection, we need to use the “user-select” property. This property is used to disable or enable the text selection. You can disable text if you don’t want users to copy your texts. If you want to disable text selection, we need to assign the “none” value to the “user-select” property. If you want to enable text selection, we need to assign a “contain” value to the “user-select” property. Let’s see a demo example:

Ex:

CSS:

p{
   user-select: none;
}

HTML :

<p>This text is unselectable, which means users can't copy this text.</p>

Live Preview:

This text is unselectable, which means users can’t copy this text.

Leave a Reply