<div>
  <h1>selection pseudo-element.</h1>
  <p>This pseudo-element simply targets highlighted contents on the webpage and you can easily add styles to it.</p>
</div>
::selection  {
    color: red;
    background: black;
}

div > p::selection {
  color: blue;
  backgroung: grey;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.