3

I want to get rid of the faded blue highlight color for certain elements (in particular, images). Here's a Fiddle for examplary purposes. Notice that when you highlight the text, it's appropriately yellow, as per the CSS. But when you drag-select to encompass the kittens, and/or you simply press CTRL+A to highlight the entire body, you get the faded blue selection color around the images.

Chrome lets you disable this entirely and/or change it. Is there really no Mozilla equivalent? Because evidently ::-moz-selection is not the answer:

div ::-moz-selection {
    background-color: yellow;
}

This only works for the text. What about a method using JavaScript? Does such a thing exist?

daveycroqet
  • 2,667
  • 7
  • 35
  • 61
  • Dublicate of [http://stackoverflow.com/questions/826782/css-rule-to-disable-text-selection-highlighting](http://stackoverflow.com/questions/826782/css-rule-to-disable-text-selection-highlighting) – Alex Jan 14 '14 at 07:04
  • No it isn't? I'm not talking about text-selection. Text-selection was shown to be altered in the Fiddle. – daveycroqet Jan 14 '14 at 07:19

2 Answers2

6

I don't think you can change the color of the highlight on the image but you can get rid of the highlight completely by doing this:

div {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

fiddle: http://jsfiddle.net/6Qqzq/33/

itsMeAra
  • 156
  • 1
  • 3
1

Try to use this code:

-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
Slawa Eremin
  • 5,264
  • 18
  • 28
  • I've tried applying that to 'html' in my CSS, with no success. Is that improper usage for some reason? Should I not be able to set it for the entire document on 'html' or 'body'? – daveycroqet Jan 14 '14 at 10:18