日期:2014-05-17  浏览次数:20679 次

css3 ::selection
Summary

The ::-moz-selection (::selection) pseudo-element applies to the portion of a document that has been highlighted (e.g. selected with the mouse) by the user.

Examples

/* draw any selected text yellow on red background */
::-moz-selection { color: gold;  background: red; }
::selection      { color: gold;  background: red; }

/* draw selected text in a paragraph white on black */
p::-moz-selection { color: white;  background: black; }
p::selection      { color: white;  background: black; }
Notes

Gecko/Firefox supports ::-moz-selection, use also ::selection other browsers.

The following properties apply to ::-moz-selection :
color, background and background-color (background-image is ignored).

Specifications

::selection was drafted for CSS3 Selectors but removed from the current CSS3 draft. Anyhow, it's implemented in browsers and support will continue.

CSS 3 Selectors (Draft 2005-12-15) Obsolete
CSS 3 Selectors #selection Working draft





https://developer.mozilla.org/En/CSS/::selection