create 3D image hover effect using html and css
3D Image Hover Effect in CSS3
HTML CODE
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="4000">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3D Hover Effect</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="row">
<div class="tdimension">
<a href="#">
</a>
</div>
</div>
</div>
</body>
</html>
CSS Code(style.css)
body {
background: #ECECEC;
}
.container {
width: 100wh;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.row {
margin-top: 12px;
}
.tdimension {
width: 300px;
height: 300px;
margin: 20px auto 40px auto;
perspective: 1000px;
}
.tdimension a:after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 40px;
background: linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.1));
transform: rotateX(90deg);
transform-origin: bottom;
}
.tdimension a {
display: block;
width: 100%;
height: 100%;
background: url("https://mir-s3-cdn-cf.behance.net/project_modules/disp/e8346826957515.56361c2106f3f.png");
background-size: cover;
transform-style: preserve-3d;
transform: rotateX(70deg);
transition: all 0.8s;
}
.tdimension:hover a {
transform: rotateX(20deg);
Comments
Post a Comment