我希望解决这个图片中的问题:
如何解决红色和紫色 div 折叠时的空白间隔!
是否因为透视属性?
非常感谢!
![want to resolve the question img](https://istack.dev59.com/MoPGX.webp)
div {
width: 200px;
height: 100px;
background: #333;
}
.fold-div {
position: relative;
animation-duration: 2s;
animation-iteration-count: infinite;
animation-timing-function: ease-in-out;
}
#div1 {
background: #d94f5c;
animation-name: fold-top;
transform-origin: top;
}
#div2 {
background: #742fad;
animation-name: fold-bottom;
transform-origin: bottom;
}
@keyframes fold-top {
100% {
transform: perspective(50px) rotateX(-8deg);
height: 0;
}
}
@keyframes fold-bottom {
100% {
transform: perspective(50px) rotateX(8deg);
height: 0;
}
}
<div></div>
<div class="fold-div" id="div1"></div>
<div class="fold-div" id="div2"></div>
<div></div>