CSS Trick
3D animated, layered img effect
by Soya Natsuki
HTML
<html>
<head>
<title>Layered Image Hover Effects</title>
</head>
<body>
<div class="container-header">
<h5>Hover mouse on the image!</h5>
</div>
<div class="container">
<img src="https://cdn.dribbble.com/users/1217824/screenshots/4734765/attachments/1067102/dashboard.jpg">
<img src="https://cdn.dribbble.com/users/1217824/screenshots/4734765/attachments/1067102/dashboard.jpg">
<img src="https://cdn.dribbble.com/users/1217824/screenshots/4734765/attachments/1067102/dashboard.jpg">
<img src="https://cdn.dribbble.com/users/1217824/screenshots/4734765/attachments/1067102/dashboard.jpg">
</div>
</body>
</html>
CSS
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.container-header {
position: absolute;
top: 10px;
color: #333;
}
.container {
position: relative;
top: 70px;
width: 180px;
height: 390px;
background: rgba(0,0,0,.1);
transform: rotate(-30deg) skew(25deg) scale(.8);
transition: 0.5s;
border-radius: 20px;
}
.container img {
position: absolute;
width: 100%;
transition: 0.5s;
border-radius: 20px;
}
.container:hover img:nth-child(4) {
transform: translate(80px, -80px);
opacity: 1;
}
.container:hover img:nth-child(3) {
transform: translate(60px, -60px);
opacity: .8;
}
.container:hover img:nth-child(2) {
transform: translate(40px, -40px);
opacity: .6;
}
.container:hover img:nth-child(1) {
transform: translate(20px, -20px);
opacity: .4;
}