What you can do is select the following item (s):
Combined Adjacent Brother
element1 + element2 Selects each element2 element, which is placed immediately after element1 elements. They are brothers and sisters.
#element img:hover + #otherelement
If #otherelement placed immediately after img , it will be selected when img is visible.
Another variant:
General Meeting Combinator
element1 ~ element2 Corresponds to the occurrences of element2 preceded by element1 , while they have the same parent. They are also siblings, but element2 does not have to precede element1 .
#element img:hover ~ #otherelement
If #otherelement and img are siblings, and #otherelement is placed somewhere after img , it will be selected when img is hovering.
Here is an example
HTML
<div id="parent"> <img src="http://lorempixel.com/200/200/" alt="Sport"> <div class="text">This is a text.</div> </div>
CSS
#parent { overflow: hidden; width: 200px; height: 200px; } .text { position: relative; -webkit-transition: .3s all; -moz-transition: .3s all; transition: .3s all; background-color: rgba(255,255,255,.5); height: 40px; line-height: 40px; } #parent img:hover + .text { top: -40px; }
source share