::selection

The ::selection pseudo-element is used to style the part of the page that is highlighted by the user. The ::selection is limited to only a small number of the CSS properties including:

  • background-color
  • color
  • cursor
  • outline
  • text-decoration
  • text-shadow
p::selection {
  background-color: tomato;
  color: white;
}

This YouTube video was created by Steve Griffith.