This CSS rule …
::selection
{
background-color:#f1f1f1;
}
::-moz-selection
{
background-color:#f1f1f1;
}
… produces this effect in Chrome:
As you can see, some parts of the selection is default blue. How can I make the entire selection grey?
-moz- is the prefix for firefox
try -webkit- it's for chrome and safari
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.
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;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.