Selection Pseudo Element - CSS Pseudo | CSS: Presentation Layer
Standards Based Development
selection Pseudo Element.
/* white text with pink background */
::-moz-selection {
background: #FE57A1;
color: #FFF;
text-shadow: none;
}
::selection {
background: #FE57A1;
color: #FFF;
text-shadow: none;
}
Firstly, it must be noted that Firefox's vendor prefix will ignore the styles if used in a group selector. Also, see that text-shadow has been turned off on hover; this is a *best-practice, for upkeeping legibility and readability, but it is not necessarily a rule.
selection pseudo-element applies rules to the portion of a document that has been highlighted by the user, such as selected with the mouse.
Only a small subset of properties can be used in a rule using the selection in its selector: color, background, and background-color.