在练习实现图片正反动态翻转时,没有实现理想效果,同时发现在内层和外层分别加overflow:auto
时,也会有不同的效果,但是不明白时为什么?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>正反翻转效果</title>
<style>
.card {
width: 640px;
height: 1124px;
position: relative;
perspective: 650px;
transform-style: preserve-3d;
transition: all 0.8s ease;
}
.back, .front {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
backface-visibility: hidden;
overflow: auto;
}
.back {
transform: rotateY(-180deg);
}
.card:hover {
transform: rotateY(180deg);
}
</style>
</head>
<body>
<div class="card">
<div class="back">
<img src="../static/img/photo_2022-11-10_08-32-07反面.jpg" alt="">
</div>
<div class="front">
<img src="../static/img/photo_2022-11-10_08-32-07正面.jpg" alt="">
</div>
</div>
<div class="card">
<div class="card-side front"><img src="../static/img/photo_2022-11-10_08-54-06正面.jpg" alt=""></div>
<div class="card-side back"><img src="../static/img/photo_2022-11-10_08-54-06反面.jpg" alt=""></div>
</div>
</body>
</html>
标签:未解,效果,back,transform,rotateY,翻转,图片
From: https://www.cnblogs.com/sherlock-V/p/16905658.html