您可以使用perspective和transformY
获得类似的输出,这是一个有效的代码段:
.scene {
position: relative;
left:100px;
width: 200px;
height: 200px;
margin: 40px;
/* perspective property */
perspective: 400px;
}
.panel {
width: 100%;
height: 100%;
background: blue;
transform: rotateX(-45deg);
}
<div class="scene">
<div class="panel"></div>
</div>
您可以从这样的内容开始:
.container {
overflow: hidden;
}
#childContainer {
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-top: 100px solid red;
height: 0;
width: 100px;
}
<div class="container">
<div id="childContainer">
</div>
</div>