3D Flip Hover Effect
HTML :
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>3D Hover by Growcode</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="front side">
<div class="content">
<h1>Welcome</h1>
</div>
</div>
<div class="back side">
<div class="content">
<h1>Contact Me</h1>
<form>
<label>Your Name :</label>
<input type="text" placeholder="Enter your name">
<label>Your E-mail :</label>
<input type="text" placeholder="abcd@mail.com">
<label>Message :</label>
<textarea placeholder=""></textarea>
<input type="submit" value="Done">
</form>
</div>
</div>
</div>
</body>
</html>
CSS :
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100vh;
display: flex;
justify-content: center;
-ms-flex-align: center;
align-items: center;
-webkit-perspective: 1000px;
perspective: 1000px;
-webkit-transform-style: preserve-3d;
transform-style: preserve-3d;
position: relative;
background-color: rgb(95, 95, 95);
font-family: "Montserrat";
}
.container {
min-width: 700px;
min-height: 350px;
border-radius: 20px;
position: relative;
transition: 1.5s ease-in-out;
transform-style: preserve-3d;
}
.side {
position: absolute;
text-align: center;
width: 100%;
height: 100%;
padding: 20px 50px;
color: #fff;
transform-style: preserve-3d;
backface-visibility: hidden;
border-radius: 20px;
}
.content {
transform: translatez(70px) scale(0.8);
line-height: 1.5em;
}
.content h1 {
position: relative;
}
.content p {
margin-top: 50px;
line-height: 2em;
}
.content h1:before {
content: "";
position: absolute;
bottom: -20px;
height: 3px;
background-color: rgb(0, 225, 245);
width: 100px;
left: 50%;
transform: translateX(-50%);
}
.front {
z-index: 2;
background-size: 100vh;
background-size: cover;
background-image: url(https://ak.picdn.net/shutterstock/videos/1068252812/thumb/11.jpg?ip=x480);
}
.back {
background-color: #333;
transform: rotateY(180deg);
z-index: 0;
padding-top: 10px;
background-image: url(https://st4.depositphotos.com/12985848/i/600/depositphotos_198501094-stock-photo-blue-abstract-smoke-black-background.jpg);
}
.container:hover {
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
}
form {
text-align: left;
}
.back h1 {
margin: 0;
}
form label,
form input {
display: block;
}
form input,
form textarea {
background: transparent;
border: 0;
border-bottom: 2px solid #444;
padding: 5px;
width: 100%;
color: #fff;
}
form label {
margin: 15px 0;
}
form input[type="submit"] {
display: block;
margin: 10px auto;
padding: 5px 10px;
border: 3px solid #555;
border-radius: 4px;
color: #fff;
cursor: pointer;
}
Comments
Post a Comment