Blog Post

Changing the Look and Feel of Selected Text

You can change the look of a selection with the ::selection pseudo element. For instance,

::selection {
  background-color: pink;

changes the background color of the selection to pink. There are limits on what changes you can make using the selection pseudo element though, you can only change: color, background-color, text-decoration and text-shadow every other vendor-neutral property will be ignored.