<!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>
<style>
.flip-card {
perspective: 1000px;
position: relative;
width: 400px;
height: 600px;
box-sizing: border-box;
}
.flip-card-inner {
width: 100%;
height: 100%;
text-align: center;
transition: transform 0.6s;
transform-style: preserve-3d;
-webkit-backface-visibility: hidden;
/* Chrome and Safari */
-moz-backface-visibility: hidden;
/* Firefox */
-ms-backface-visibility: hidden;
/* Internet Explorer */
}
.flip-card:hover .flip-card-inner {
transform: rotateY(180deg);
}
.flip-card-front,
.flip-card-back {
-webkit-backface-visibility: hidden;
/* Chrome and Safari */
-moz-backface-visibility: hidden;
/* Firefox */
-ms-backface-visibility: hidden;
/* Internet Explorer */
width: 100%;
height: 100%;
overflow: hidden;
position: absolute;
border-radius: 12px;
overflow: hidden;
background-color: rgba(0, 0, 0, .2);
border: 1px solid #FFFFFF;
display: flex;
flex-wrap: wrap;
align-content: flex-start;
}
.flip-card-back {
width: 100%;
background-color: rgba(255, 94, 94, 0.2);
height: 100%;
transform: rotateY(180deg);
}
</style>
</head>
<body>
<div class="flip-card">
<div class="flip-card-inner">
<div class="flip-card-front">
正面
</div>
<div class="flip-card-back">
反面
</div>
</div>
</div>
</body>
</html>
前端实现扑克牌翻转效果
最新推荐文章于 2024-08-16 16:25:26 发布