Search w3schools.com:

SHARE THIS PAGE

CSS Reference

CSS Reference CSS Selectors CSS Reference Aural CSS Web Safe Fonts CSS Units CSS Colors CSS Color Values CSS Color Names CSS Color HEX CSS3 Browser Support

CSS Properties

CSS3 ::selection Selector

Complete CSS Selector Reference Complete CSS Selector Reference

Example

Make the selected text red:

::selection
{
color:#ff0000;
}
::-moz-selection
{
color:#ff0000;
}

Try it yourself »

Definition and Usage

The ::selection selector matches the portion of an element that is selected by a user.

Only a few CSS properties can be applied to ::selection: color, background, cursor, and outline.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The ::selection selector is supported in IE9+, Opera, Google Chrome and Safari.

Firefox supports an alternative, the ::-moz-selection.


Complete CSS Selector Reference Complete CSS Selector Reference


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]