I want to select a non-descendant element with css on hover. To be more precise, when I hover on the image with id="tapas"
, I want to change the visibility of the text with id="cuerpo"
.
<div id="tapa">
<div class="imgagenes">
<img src="img/tapas.jpg" id="tapas">
<img src="img/tapitas.jpg" id="tapitas">
</div>
<div class="text">
<p id="cuerpo">
There is text here
</p>
</div>
</div>
Some time before I had the text in the same div, with id="imgagenes"
, but I don't want that right now. Therefore, I had this command on css:
#tapas:hover ~ p {
visibility: visible;
}