读书人

css3 :selection

发布时间: 2012-08-22 09:50:34 作者: rapoo

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

读书人网 >CSS

热点推荐