Skip to content
Related Articles

Related Articles

CSS | ::selection Selector

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 18 Dec, 2018

The selection selector is used to set the CSS property to the part of document that is selected by the user (such as clicking and dragging the mouse across text). Only some CSS properties is used with ::selection selector. Supported CSS property are color, background, cursor, and outline.


::selection {
    // CSS Property


<!DOCTYPE html>
        <title>::selection Selector</title>
            h1 {
                color: green;
            body {
            /* CSS property for Firefox */
            ::-moz-selection { 
                color: white;
                background: green;
            ::selection {
                color: white;
                background: green;
        <h2>::selection selector</h2>
        <p>A Computer Science portal for geeks </p>


Supported Browsers: The browser supported by ::selection Selector are listed below:

  • Apple Safari 3.1
  • Google Chrome 4.0
  • Firefox 62.0 2.0-moz-
  • Opera 10.1
  • Internet Explorer 9.0

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!