Pour changer la couleur de fond d'un texte en HTML, vous pouvez entourer le texte par une balise <span>...</span>
, puis créer une CLASS nommée stabilo avec la propriété CCS background-color
:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Comment changer la couleur de fond d'un texte en HTML ?</title>
<style>
.stabilo {
background-color: #FFFF00
}
</style>
</head>
<body>
Exemple de page Web avec <span class="stabilo">un texte stabiloté</span>.
</body>
</html>
Démonstration dans le Bac à codes.