CSS Selector ::selection








The ::selection selector selected the user-selected part of an element.

CSS Syntax

::selection {
   style properties 
}

Browser compatibility

::selection Yes 9.0 Yes Yes Yes




Example

An example showing how to use ::selection CSS selector.

<!DOCTYPE html>
<html>
<head>
<style>
::selection{<!--from  ww w.ja  v  a 2s.  c o m-->
   color:#ff0000;
}

</style>
</head>
<body>
   <p>Drag to select this paragraph.</p>
</body>
</html>

Click to view the demo