Skip to content

Instantly share code, notes, and snippets.

@PhilippeVay
Last active November 24, 2017 15:16
Show Gist options
  • Save PhilippeVay/a7a9a8c62918db47f05bd75256baa439 to your computer and use it in GitHub Desktop.
Save PhilippeVay/a7a9a8c62918db47f05bd75256baa439 to your computer and use it in GitHub Desktop.
::selection - custom colors for selection of text by the user
/*
* User selecting text: custom colors
* Beware of white text on dark background: you must redefine ::selection for these cases
*
* MDN: https://developer.mozilla.org/fr/docs/Web/CSS/::selection
* Autoprefixer does take care of adding needed -moz- prefix
*
*/
::selection {
color: white;
background-color: rgba(255, 32, 32, 0.995); // because of Chrome. Source: https://stackoverflow.com/a/43139296/137626
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment