1

This CSS rule …

::selection
{
background-color:#f1f1f1;
}
::-moz-selection
{
background-color:#f1f1f1;
}

… produces this effect in Chrome:

enter image description here

As you can see, some parts of the selection is default blue. How can I make the entire selection grey?

Mr. Alien
  • 153,751
  • 34
  • 298
  • 278

3 Answers3

2

-moz- is the prefix for firefox

try -webkit- it's for chrome and safari

GMZ
  • 334
  • 1
  • 10
1

it must be in another <div> or something like that. Check around to fine anywhere else that sets a background colour. Without more code not much more we can do.

Also find the different brower types of

-moz-selection

as that is just firefox.

Ruddy
  • 9,795
  • 5
  • 45
  • 66
0

I use the following to prevent selection of all elements on a page... Hope it helps!

*{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
Kai
  • 277
  • 1
  • 3
  • 14