Hello everyone! I am just starting out with html, so please forgive any mistakes in my syntax.
I have some simple html code and I am trying to achieve a hover effect. When I hover over the number 1, I want the text "This is the first match" to change color further down in the document. To accomplish this, I have written the following CSS:
#number1:hover ~ #match1{
color: yellow;
}
#number2:hover ~ #match2{
color: yellow;
}
Please hover over this number to see the respective match
<a id="number1">1</a>
<br>
Or hover over this number to see the respective match
<a id="number2">2</a>
<br>
<a id="match1">This is the first match</a>
<br>
<a id="match2">This is the second match</a>
However, I have multiple connections where I would like to apply this same pattern, not just these two examples. Is there an easy way to implement this globally throughout the document?
I'm not sure if using '<a>
' is the correct approach. I thought about possibly using 'href
', but I'm uncertain.
Thank you for your help in advance!