html - Change text opacity when hovering a image -


hi want change text opacity when hovering image. tried use doesn't work:

html:

<div class="text">         text     </div>  <img src="image1.jpg" class="first-image"> 

css:

.text { opacity: 0; }  .first-image:hover { text.opacity: 1; } 

if want way doing pure css, revised snippet below:

<dic class="first-image">  <img src="image1.jpg" alt="first-image"/>  <div class="text">some text</div> </div> 

..

.text {    opacity: 0;   }    .first-image:hover > div{      opacity: 1;    } 

Comments