1、这是结构代码,实现两个体形盒子对称
<div class="container"> <div class="box1"></div> <div class="box2"></div> </div>
2、这是CSS样式代码
.container { width: 400px; height: 400px; border: 2px solid #000; margin: 50px auto; text-align: center; line-height: 400px; background: linear-gradient(to right, skyblue, white); } .container div { display: inline-block; } .container .box1 { width: 100px; height: 0; border-top: 80px solid pink; border-top-left-radius: 10px; border-bottom-left-radius: 10px; border-right: 20px solid transparent; border-bottom: 0 solid deeppink; border-left: 0 solid skyblue; } .container .box2 { width: 100px; height: 0; border-top: 0 solid pink; border-right: 0 solid transparent; border-bottom: 80px solid deeppink; border-left: 20px solid transparent; border-top-right-radius: 10px; border-bottom-right-radius: 10px; }
最终的运行结构是
标签:right,container,实现,梯形,height,solid,radius,border,CSS From: https://www.cnblogs.com/smile-fanyin/p/18206236