1

I'm learning HTML/CSS right now, so I did this little cookie-clicker lookalike for fun : http://jsfiddle.net/Zerh/6kb87sp9/

My problem is : if I click too fast on any button (double click) it highlights a selection. I used the following CSS for hiding the highlight :

::selection {
   background: transparent;
}
::-moz-selection {
   background: transparent;
}

It seems to work on Firefox/Edge but I can't get it to work on Chrome.

I found this old topic : How to disable text selection highlighting using CSS?, but it's 6 years old and doesn't seem to work for me.

Aubin
  • 14,617
  • 9
  • 61
  • 84
Samuel-Zacharie Faure
  • 1,047
  • 11
  • 26

1 Answers1

5

I think this will disable on any element

.noselect {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

I think this will solve your problem you just need to add the class "noselect" to the element you want

Pedro Cavaleiro
  • 835
  • 7
  • 21