Multi Layered image effect on mouse hover with the help of simple css | Sanwebcorner

Multi Layered image effect on mouse hover with the help of simple css

In this post will tell you how to create multi layered image effect on mouse hover with the help of simple css3 code. And it is also called as a multi layered 3d effect on mouse hover. We have create four different layers with different transform direction to show the layers. And we also set the different opacity of each layers. The first one opacity is 0.4 second one 0.6 and third one 0.8 and final and fourth layer opacity point is 1.0. So this layers view when hover the particular image in different opacity value.


Multi Layered image effect
 The below line shows the 3d layers

.container:hover img:nth-child(4){
transform: translate(160px, -160px);
opacity: 1;
}
.container:hover img:nth-child(3){
transform: translate(120px, -120px);
opacity: 0.8;
}
.container:hover img:nth-child(2){
transform: translate(80px, -80px);
opacity: 0.6;
}
.container:hover img:nth-child(1){
transform: translate(40px, -40px);
opacity: 0.4;
}

I hope this multi layered image 3D effect on mouse hover example will really helpful. It is also looking very nice to see. Here i provided the live demo, please check the live demo to see the multi layered effect. And here have the full code use this code to your projects.

Code for Multi-layered image effect on hover:

<!DOCTYPE html>
<html>
<head>
<title>Multi Layered Effect with CSS3</title>
<style>
body{
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
}
.container{
position: relative;
width: 360px;
margin-top: 250px;
background: rgba(0, 0, 0, 1);
background-size: cover;
transform: rotate(-20deg) skew(30deg) scale(0.9);
transition: 0.5s;

}
.container img{
position:  absolute;
width: 300px;
height: 250px;
transition: 0.5s;
cursor:  pointer;
}
.container:hover img:nth-child(4){
transform: translate(160px, -160px);
opacity: 1;
}
.container:hover img:nth-child(3){
transform: translate(120px, -120px);
opacity: 0.8;
}
.container:hover img:nth-child(2){
transform: translate(80px, -80px);
opacity: 0.6;
}
.container:hover img:nth-child(1){
transform: translate(40px, -40px);
opacity: 0.4;
}
</style>


</head>
<body>
<div class="container">
<img src="display-popup-on-page-load.png">
<img src="display-popup-on-page-load.png">
<img src="display-popup-on-page-load.png">
<img src="display-popup-on-page-load.png">
</div>
</body>
</html>