I can change the CSS selection color, but how can I get the browser/OS default selection so that I can use it elsewhere?
e.g. on Ubuntu+Chrome text is highlighted in orange.

I want to apply this same style to an <li> when I hover over it with my mouse.
In the CSS2 specs some color keywords are defined. They should still work just fine but might not necessarily reflect how selected text look like:
.selected {
background: Highlight;
color: HighlightText;
}
<p>Lorem ipsum with some <span class="selected">selected text</span></p>
//edit: The previous answer stated, that those keywords are deprecated. As @vpzomtrrfrt pointed out in the comments below, they are not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With