When I hover the over an image img1
, I want the corresponding text text1
to appear. The same goes for img2 and text2, and so on.
Here is the code of what I tried, but the text doesn't appear when I hover on the images. What am I doing wrong?
here is my html
<section>
<div class="planche">
<img class="img1" src="./images/1.jpg">
<img class="img2" src="./images/2.jpg">
<img class="img3" src="./images/3.jpg">
</div>
<div class="text1">
<p>
TEXTE 1
</p>
</div>
<div class="text2">
<p>
TEXTE 2
</p>
</div>
<div class="text3">
<p>
TEXTE 3
</p>
</div>
</section>
and here is my css:
.img1:hover .text1 {
opacity: 1;
background-color: white;
}