I'm trying to change a display
property when hover
another div.
.pc-hover {
display: none;
}
.pc-content-image img:hover + .pc-hover {
display: block;
}
<div class="profile-content">
<div class="pc-hover">{hover}</div>
<div class="pc-header">{head}</div>
<div class="pc-content">
<div class="pc-content-image">
<img src="https://via.placeholder.com/300" alt="placeholder" />
</div>
<div class="pc-content-text">
<p>{text}</p>
<p>{text2}</p>
</div>
</div>
</div>
Initially, pc-hover
is not showing until the mouse hovers the image from pc-content-image
. But nothing happens when I hover over the image.
I've seen some references from Using only CSS, show div on hover over another element, but I don't understand how to do it.
Tried to use +
and ~
, but not working.
Is there a way to achieve this? Appreciate any kinda helps, thanks.