What I am trying is, when the mouse is over the link of #first-block1
, the link of #first-block2
should get underline. Only through CSS not javascript.
#first-block1:hover {
#first-block2 {
text-decoration: underline;
}
}
<p><a id="first-block1" href=""><span style="color:black;">yoast.com</span> <span style="color:#515A5A">> SEO blog > SEO Basics</span></a><br><a id="first-block2" href="">Elements of Google Search Engine Results Page. SEO for ...</a></p>
5
Answers
Just put it on the same line.
Here what I has to do if I was in charge of it:
Depending on your HTML, it could be
You need to use the
~
sibling selector instead of the more direct+
next element selector since you have a<br>
tag between your<a>
tags. (More on selectors: https://www.w3schools.com/cssref/css_selectors.asp).Also, you can’t nest classes/ids, unless you are using a preprocessor like SASS/SCSS/LESS.