Source Code: (back to article)
<!DOCTYPE html>
<html>
<head>
<title>Titre du document</title>
<style>
.green::-moz-selection{
background-color: #8ebf42;
}
.green::selection{
background-color: #8ebf42;
}
.yellow::-moz-selection{
background-color: #1c87c9;
}
.yellow::selection{
background-color: #1c87c9;
}
</style>
</head>
<body>
<h2>Exemple du sélecteur ::selection</h2>
<p>C'est un texte avec background-color initiale de sélection.</p>
<p class="green">Sélectionnez le texte pour voir un arrière-plan vert.</p>
<p class="yellow">Sélectionnez le texte pour voir un arrière-plan jaune.</p>
</body>
</html>