<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="./card.css">
</head>
<body>
<div class="container">
<div class="just">我在前</div>
<div class="back">我在后</div>
</div>
</body>
</html>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background-image: radial-gradient(circle 588px at 31.7% 40.2%,
rgba(225, 200, 239, 1) 21.4%,
rgba(163, 225, 233, 1) 57.1%);
padding: 25px;
}
.container {
width: 150px;
height: 200px;
position: relative;
perspective: 1000px;
}
.just,
.back {
width: 100%;
height: 100%;
position: absolute;
backface-visibility: hidden;
transition: transform 0.25s ease-in-out;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
}
.just {
transform: rotateY(0deg);
background-image: linear-gradient(109.6deg,
rgba(245, 56, 56, 1) 11.2%,
rgba(234, 192, 117, 1) 78%);
}
.container:hover .just {
transform: rotateY(180deg);
}
.back {
transform: rotateY(-180deg);
background-image: linear-gradient(117deg,
rgba(123, 216, 96, 1) 39.2%,
rgba(255, 255, 255, 1) 156.2%);
}
.container:hover .back {
transform: rotateY(0deg);
}