Answer the question
In order to leave comments, you need to log in
How to set animation to two child elements?
<div class="img-wrapper">
<img src="img/1.jpg" alt="">
</div>
.img-wrapper
position: relative
margin: 50px auto
width: 250px
height: 450px
border: 2px solid brown
overflow: hidden
img
width: 100%
height: 100%
object-fit: cover
transition: .2s all
&:hover
&::before
background-color: transparentize(black, 1)
img
transform: scale(1.05)
&::before
content: ''
position: absolute
width: 100%
height: 100%
background-color: transparentize(black, 0.5)
transition: .2s all
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question