I would like to hover in a.bio
change the background .pic
to green.
I tried some ways, but it did not work out.
I did not understand th
Move your a.bio
in your HTML, because ~
is a sibling selector (however less strict than the +
), and use position
to stay as it was before moving the HTML:
.executivo .pic::after {
background-color: #00845b;
content: "";
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
opacity: 0;
transition: .3s ease-in-out;
}
.executivo {
position: relative;
}
.executivo a.bio {
position: absolute;
bottom: -20px
}
.executivo a.bio:hover ~ .pic img {
opacity: 0.35;
}
.executivo .pic {
margin-bottom: 45px;
position: relative;
}
.executivo .pic img {
display: block;
max-width:100% /*demo*/
}
<div class="executivo">
<a class="bio" href="#">Bio+</a>
<div class="pic">
<img src="//lorempixel.com/1600/900" alt="alt text" />
</div>
<div class="title">
<h3>title</h3>
</div>
</div>
Nex element selector is
+
And direct decedent is
>
in css.
Does this help you answer your question?