<html>
<head/>
<body>
<p class = "red"> Texto seleccionable en rojo </p>
<p class = "blue"> Texto seleccionable en azul </p>
<p class = "yellow"> Texto seleccionable en amarillo </p>
<p class = "letras"> Letras cambiando de color </p>
</body>
</html>
Welcome to StackOverflow in Spanish
Here is a simple example
Source : css-tricks
You can make use of css selector
::selection
For example...
I leave you the Link of the selector...
To change the background color and color of the selected text we can do it through
CSS3
the selector::selection
that also supports these properties:color
: for the font color of the selected text.background-color
: for the background color of the selected text.text-shadow
: to set a shadow effect of theselected text.
The following example shows red selected text with a yellow selection background.
Hope this can help you!