Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS: ::selection { background: #000000; color: #ffffff } not appearing as full black

::selection { background: #000000; color: #ffffff } 

Is resulting in a dark grey selection color, not full black (#000000). Changing opacity makes no difference.

How do I make the selection color appear as #ffffff?

like image 973
user852974 Avatar asked Dec 04 '11 00:12

user852974


People also ask

What is the use of :: selection in CSS?

The ::selection selector matches the portion of an element that is selected by a user. Only a few CSS properties can be applied to the ::selection selector: color, background, cursor, and outline.

How do I change the color of selection in CSS?

To change the selected option background-color CSS style, we can set the style attribute of the select and option elements. to set the whole select element to background color 009966 and color FFF . Then we override the the styles in the option elements with style="background: white; color: black;" .

How do you change the background color of selected text?

You can change the background color and color of selected text by styling ::selection . Styling this pseudo element is great for matching user-selected text to your sites color scheme.


1 Answers

This worked for me:

::selection {
   background: rgba(0, 0, 0, 0.99);
   color: #FFF;
}
like image 128
Nenad Avatar answered Oct 09 '22 18:10

Nenad