Browsers have a default text selection color (mainly, blue or orange). However, this setting can be overrided with the CSS pseudo-element ::selection. This overrides the browser-level text selection color with a color of our choosing. It is definitely one of the "forward-enhancement" techniques we have today. It is a pleasure for those using modern browsers.
Note that, the double colon is strictly necessary in the syntax for this pseudo element particularly. Although other pseudo elements accept a single colon in syntax.
Only Safari and Firefox are the two browsers supporting this, and that too in different ways.
Using this pseudo element is great, especially when you want to match the user-selected text to your site's color scheme.
There are three properties that ::selection works with:
If you try a property other than these, that property will be ignored.
<p>Select me to see normal behavior.</p>
<p class='example-color'>Try selecting me for a different text color.</p>
<p class='example-background-color'>You can select me for a different background color.</p>
<p class='example-background'>You can also select me for a different background.</p>
<p class='example-both'>Guess what… you can select me for a different background color and text color.</p>
<p class='example-shadow'>How about a text-shadow? Sure, select me for a different text-shadow.</p>