.linux-face {
&:hover {
.info {
opacity: 0;
}
}
}
gets compiled into
.linux-face:hover .info { opacity: 0; }
but .linux-face
is an img
element so you are actually targeting a nested element inside the image which clearly doesn't exist —
if your goal is to change the opacity
of the .info
element when you hover the image then you can't simply do it with the given markup: the most you could do is .image-section:hover + .info { opacity: 0 }
so it will work if you hover either the image or the caption paragraph.
As a side note you could use a more meaningful and semantic markup
<figure>
<img src="img/linus_torvald.jpg" alt="Linus Torvald smiling face" />
<figcaption>Linus Torvald smiling face</figcaption>
</figure>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…