Disable DIV selection when clicking on it

How can I avoid selecting a div and hide the selection when I click? I want to hide the dotted diagram:
here's a screenshot if what i want to hide

(a screenshot cannot appear, here it is: http://i.stack.imgur.com/3OKaP.png )

+7
source share
5 answers

Use outline:none or outline:0

Check similar here

+9
source

this can be done using the css class. e.g. .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> 
+3
source

Add outline:0; to your div .

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

Ref here for more information:

+2
source

Not sure if this is what you are looking for, but check out Chris Coyer's article (removing the dotted diagram) on this

But think about usability issues if you don't set up an alternative active state at all. But I think Chris mentions this anyway.

0
source
 *:focus{outline:none} 
  • add this code to your css file. This is a css problem
0
source

All Articles