CSS3 ::selection selector
Complete CSS Selector Reference Manual
Example
Make the selected text red:
::selection
{
color:#ff0000;
}
::-moz-selection
{
color:#ff0000;
}
Try it »
Definition and Usage
::selection selector matches the portion of an element that is selected or highlighted by the user.
::selection can only be applied to a few CSS properties: color, background, cursor, and outline.
Browser support





IE9+, Opera, Google Chrome, and Safari support the ::selection selector.
Firefox supports it through its private property ::-moz-selection.