前面那个面需要向前移动盒子的一半创建立体空间,才能使整个盒子旋转90度后能全部覆盖住
<body>
<ul>
<li>
<div class="box">
<div class="front">8989</div>
<div class="bottom">WOAINA</div>
</div>
</li>
</ul>
</body>
<style>
* {
margin: 0;
padding: 0;
}
ul {
width: 520px;
background-color: antiquewhite;
display: flex;
justify-content: space-between;
margin: 100px;
}
ul li {
width: 120px;
height: 35px;
perspective: 500px;
list-style: none;
}
.box {
position: relative;
width: 100%;
height: 100%;
transform-style: preserve-3d;
transition: all 1S;
}
.box:hover {
transform: rotateX(90deg);
}
.front,
.bottom {
width: 100%;
height: 100%;
position: absolute;
text-align: center;
line-height: 35px;
}
.front {
background-color: pink;
transform: translateZ(17.5px);
z-index: 1;
}
.bottom {
background-color: blue;
transform: translateY(17.5px) rotateX(-87deg);
}
</style>
195

被折叠的 条评论
为什么被折叠?



