I need to change the color of a <p>
to red (color:red;
) whenever the checkbox is checked:
input:checked~.txt {
color: red;
}
<div>
<p class="txt">CodePen!</p>
<input type="checkbox" />
</div>
I expect the result as we checked that box that the color of the txt
needs to be changed to red.
Aucun commentaire:
Enregistrer un commentaire