Make text unselectable on an html page

unselectable, CSS, disble text select, restrict text selection, disable selecting text, javascript diabling text select, css siabling text select

For disabling the text copy paste option

Add these lines in your stylesheet

*.unselectable {
   -moz-user-select: -moz-none;
   -khtml-user-select: none;
   -webkit-user-select: none;

   /*
     Introduced in IE 10.
  */
   -ms-user-select: none;
   user-select: none;
}

For IE < 10 and Opera, you will need to use the unselectable expando property of the element you wish to be unselectable. You can set this using an attribute in HTML:


Give a class name for your div and also add unselectable="on" in your div

<div id="container" unselectable="on" class="unselectable">
 your contents here
</div>

Now see the difference the selecting text is disabled.

Hope this article is helpful for you cheers :)

Post a Comment

Analytics