Disable DIV selection when clicking on it

this worked in my case:

element {

-webkit-tap-highlight-color: transparent;

}

as per Mozilla Docs


Add outline:0; to your div.

I usually see this problem on IE more than other browsers.

Ref here for more info:


it can be done with a css class . like .if this is your div :

<div class='disableSelection'>text</div>

then apply this css .

<style>
.disableSelection{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
outline: 0;
}
</style>

Useoutline:none or outline:0

Check the similar one here

Tags:

Html

Css