-
-
Save YuraKolesnikov/40f5cf5e2a473ff347acd63e6f849bdc to your computer and use it in GitHub Desktop.
Div animation on hover
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Container styling */ | |
.container { | |
position: relative; | |
width: 360px; | |
height: 640px; | |
margin-top: 150px; | |
background: rgba(0,0,0,0); | |
transform: rotate(-30deg) skew(25deg) scale(.8); | |
transition: all .5s ease; | |
} | |
.container img { | |
position: absolute; | |
width: 100%; | |
transition: .5s ease; | |
} | |
.container:hover img:nth-child(5) { | |
transform: translate(160px, -160px); | |
opacity: 1; | |
} | |
.container:hover img:nth-child(4) { | |
transform: translate(120px, -120px); | |
opacity: .8; | |
} | |
.container:hover img:nth-child(3) { | |
transform: translate(80px, -80px); | |
opacity: .6; | |
} | |
.container:hover img:nth-child(2) { | |
transform: translate(40px, -40px); | |
opacity: .4; | |
} | |
.container:hover img:nth-child(1) { | |
opacity: .2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container"> | |
<img src="img.jpg" alt=""> | |
<img src="img.jpg" alt=""> | |
<img src="img.jpg" alt=""> | |
<img src="img.jpg" alt=""> | |
<img src="img.jpg" alt=""> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment